5 ms·
Aye. The article also makes the well-know blunder of asking this question: > Is Python interpreted or compiled? The question isn't really well-formed. which i
by weland 13y ago
Aye. The article also makes the well-know blunder of asking this question:
> Is Python interpreted or compiled? The question isn't really well-formed.
which is then repeated:
> C compiles to machine code, which is then run directly on your processor. Each instruction instructs your CPU to move stuff around.
No, "C" does not "compile" to machine code. The C compiler compiles C, and sometimes does so to machine code, and there are a C compilers that compile first to a form of bytecode or other symbolic representation, then to native. <language> is compiled/interpreted is a sad leftover from the heavily-diluted introductory computer books in the 1980s.
- tadfisher 13y agoI think another source of confusion is that the term "compiler" has gained this connotation that all compilers generate low-level code from a high-level source language. However, once you understand the concepts, you realize that many things are technically compilers; source-to-source translators, for example, or ORM code generators. Hell, I would call Python's own 2to3 tool a compiler: it generates a full parse tree using a grammar, it runs some translation rules, and it generates Python 3 code.
- xmonkee 13y agoThere are no compilers. There are translators and optimizers.
- 14113 13y agoThat's the definition of a compiler though, "A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language)." All a compiler is is a combination of a translator and (possibly - but not necessarily) an optimiser.