4 ms·
This makes sense, and I even thought it might be a good idea to think of Assembler (the program) as an interpreter rather than a compiler: each line of code can
by Koshkin 4y ago
This makes sense, and I even thought it might be a good idea to think of Assembler (the program) as an interpreter rather than a compiler: each line of code can be seen as a command to emit a piece of machine code, allocate space, change state or mode, etc.
- kragen 4y agoAgreed! Conal Elliott wrote a marvelous post in 02009 describing C as a pure functional DSL whose output is code: http://conal.net/blog/posts/the-c-language-is-purely-functional http://conal.net/blog/posts/the-c-language-is-purely-functio...
- bonzini 4y agoThe assembler is not an interpreter because it doesn't produce the output of the program it assembles. However indeed it's usually called a translator (or, well, an assembler) rather than a compiler, exactly because its algorithms are simpler, and (even if it does things like resolving labels) the way a human looks at the output is as a 1:1 translation of the input.
- kragen 4y agoIt produces the output of running the program it assembles under the nonstandard semantics Koshkin is suggesting. I think assemblers are not called "compilers" purely for historical reasons: they existed for a decade or so before compilers, and initially the "compiler" was more like what we would call a linker (thus the name "compiler").