Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Single-pass to me also implies a code generator that writes the object file directly, rather than compiling to C or assembly (or some other language) as an intermediate format. But words don't mean anything anymore, so long as people can plausibly convince others that making them feel bad by calling out improper use means that they should be allowed to use words however they want, like a child owed the opportunity to exercise their unbridled spirit.


Note that loading the program into memory is also a pass. Producing an installation image is also a pass, as is installing the program into the target. When we are talking about compiler passes, we don't count these, because they are outside the compiler.

When we consider a compiler that puts out assembly language, if that works without producing an AST, just by generating assembly in a syntax-directed way as it followed the phrase structure of the code, then we call that a one-pass compiler. What it makes is assembly language, and it does that in one pass.

Producing executable code from the assembly requires another pass, but that pass belongs to the assembler. The compiler is not even running, and so it can't be a pass of that compiler.


HN's capacity for intellectual dishonesty knows no bounds. That's a dishonest attempt to bankrupt the term "single-pass compiler", and remove its value to communicate something meaningful. By that token, the Amsterdam Compiler Kit, notable for being an example of the classic multi-pass compilation strategy, is apparently not a multi-pass compiler at all! It's just a bunch of single-pass compilers.

https://en.wikipedia.org/wiki/One-pass_compiler

"a one-pass compiler is a compiler that passes through the parts of each compilation unit only once, immediately translating each part into its final machine code"

Even if you want to raise the "That's just Wikipedia! Anyone can edit it!" argument, rational thought is still not on your side.

Unlike a program that has been compiled into object code, there is no value in a program that has been compiled into assembly except to run it through an assembler and turn it into a binary. The only accurate description for this would be a two-pass compiler (not single-pass). The assembly is an intermediate representation, and the "compiler" is the union of the language frontend that outputs assembly + the assembler itself. (It does not matter that the assembler runs in a separate process and is developed independently.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: