3 ms·
In 2023, does anyone who writes a compiler inherently have to know assembly? Or even less recently...whoever wrote the first Rust, Zig, or insert <new compiled
by Solvency 3y ago
In 2023, does anyone who writes a compiler inherently have to know assembly?
Or even less recently...whoever wrote the first Rust, Zig, or insert <new compiled language> here?
Because don't you ultimately have to know how to make your own syntax translate into efficient assembly code?
Or is there someway these days for programming language designers/creators to avoid it entirely?
- dahfizz 3y agoLlvm abstracts the "backend" which generates the actual assembly for each target machine. You only have to write a "frontend" that generates an llvm intermediate representation. But in general, yes. To generate assembly you need to know assembly.
- Solvency 3y agoIs LLVM sufficiently "simpler" to learn and wield than assembly, or does it just make it easier to compile to different systems?
- jcranmer 3y agoLLVM is definitely more complex than a toy assembly you might learn in an intro computer architecture course, but it's generally somewhat less complex than working with real assembly languages. Although the complexity in LLVM is a very different kind of complexity from assembly languages; LLVM is ultimately a higher-level abstraction than machine code, and the semantics of that abstraction can be complex in its own right.
- gamache 3y agoCompiler writers can target high-level languages too; it's not uncommon to see e.g., a Blub-to-C compiler which leaves the asm parts to a different toolchain. (Lots of languages without the goal of producing native code target even higher-level languages, for example JS.) Another popular way to _sort of_ avoid assembly is to target the LLVM IR (intermediate representation), in which case LLVM takes care of optimization and producing processor-specific machine code for a bunch of CPU types. But LLVM IR is basically a fancy assembly language.
- deleted 3y ago[deleted]