|Compiler or interpreter? email@example.com (glen herrmannsfeldt) (2010-06-13)|
|Re: Compiler or interpreter? firstname.lastname@example.org (2010-06-15)|
|Re: Compiler or interpreter? email@example.com (glen herrmannsfeldt) (2010-06-16)|
|Re: Compiler or interpreter? firstname.lastname@example.org (glen herrmannsfeldt) (2010-06-17)|
|Re: Compiler or interpreter? email@example.com (BGB / cr88192) (2010-06-18)|
|Re: Compiler or interpreter? firstname.lastname@example.org (Paul Biggar) (2010-06-18)|
|Re: Compiler or interpreter? email@example.com (Al Kossow) (2010-06-18)|
|Re: Compiler or interpreter? firstname.lastname@example.org (glen herrmannsfeldt) (2010-06-18)|
|[3 later articles]|
|From:||email@example.com (Anton Ertl)|
|Date:||Tue, 15 Jun 2010 13:05:56 GMT|
|Organization:||Institut fuer Computersprachen, Technische Universitaet Wien|
|Posted-Date:||17 Jun 2010 13:15:35 EDT|
glen herrmannsfeldt <firstname.lastname@example.org> writes:
>More specific to the above mentioned discussion, is that many of
>the early DEC systems used threaded code. Does threaded code
>count as compiler or interpreter?
As our esteemed moderator writes, this is a false dichotomy. A
compiler translates the source code to something else, and an
interpreter executes either source code (rarely) or (more frequently)
intermediate code. So any programming language implementation that
uses an intermediate code (e.g., threaded code) interpreter contains
both a compiler or an interpreter.
What you are probably thinking of when you write "true compiler" is a
native code compiler, which generates machine code for a real machine
(possibly indirectly through an assembler, linker, and loader).
The line I draw between interpreted intermediate code and native code
is this: If the CPU executes the code directly, it is native code,
otherwise it is interpreted code. Two tests for the difference are:
* If the program counter of the CPU points to the code during
execution, it is native code.
* If CPUs with memory protection require execute permission, not just
read permission, to execute the code, it is native code.
In particular, "subroutine-threaded code", which consists mainly of a
sequence of native calls to routines of the run-time system, where
each routine returns to the caller, is a form of native code.
In contrast, direct-threaded code, where the program consists of a
sequence of addresses of run-time routines, and each run-time routine
ends by dispatching to the run-time routine specified by the next
address, is an interpreted intermediate code (although not necessarily
slower than subroutine-threaded code).
M. Anton Ertl
Return to the
Search the comp.compilers archives again.