Hacker News new | ask | show | jobs
by sigjuice 3218 days ago
I'm curious what are the canonical references which state that a compiler does high-level to low-level transformations?
1 comments

Googling "what is a compiler" returns this: "a program that converts instructions into a machine-code or lower-level form so that they can be read and executed by a computer." So, that's something.

It's hard to get more canonical than the Dragon Book. The Dragon Book (2nd Ed.) says this in section 1.2: "Up to this point we have treated a compiler as a single box that maps a source program into a semantically equivalent target program."

So, the most canonical source doesn't include an explicit mention of high-level to low-level (though there may be sources I'm missing). But in my experience, that's definitely the connotation. Otherwise, the term transpiler, which is connoted with not outputting low-level code, never would have arisen.

The Dragon book does not make a distinction between high-level vs low-level output because fundamentally there is none. IMHO it is quite a stretch to claim otherwise because the questionable term "transpiler" exists.
I apologize for not being clearer – I'm not claiming that they're fundamentally different. My original comment, to that point, agrees with the original article's author: compilers are just mappings to and from programs.

re: transpiler – all I'm saying is that the term arose because people associated compilers with low-level outputs.

In summary, there don't appear to be canonical definitions of compilers as having low-level outputs, but for some reason many speak of them that way.

There's also the etymology, ie. the pre-computing dictionary definition: you compile eg. a list, ie. make something smaller/shorter from a larger input. You also write a book when it's an original work, but another author or editor might take parts of yours and other books and compile an anthology. You might translate a book from one language to another, but that's not considered a compilation.
I've always been under the impression that compile means "put together" rather than "compress".
Webster lists in part:

Compiler: one who compiles - first use 14th century

And for compile:

transitive verb

1 : to compose out of materials from other documents

2 : to collect and edit into a volume

3 : to build up gradually <compiled a record of four wins and two losses>

Origin: Middle English, from Anglo-French compiler, from Latin compilare to plunder.

Synonyms: anthologize, collect

Note, I've skipped the dictionary references to computer use, as the seem overly (wrongly) focused on "top down" compilation...