Re: Compiler or interpreter?

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Wed, 16 Jun 2010 22:12:09 +0000 (UTC)

          From comp.compilers

Related articles
Compiler or interpreter? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-06-13)
Re: Compiler or interpreter? anton@mips.complang.tuwien.ac.at (2010-06-15)
Re: Compiler or interpreter? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-06-16)
Re: Compiler or interpreter? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-06-17)
Re: Compiler or interpreter? cr88192@hotmail.com (BGB / cr88192) (2010-06-18)
Re: Compiler or interpreter? paul.biggar@gmail.com (Paul Biggar) (2010-06-18)
Re: Compiler or interpreter? aek@bitsavers.org (Al Kossow) (2010-06-18)
Re: Compiler or interpreter? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-06-18)
Re: Compiler or interpreter? cr88192@hotmail.com (BGB / cr88192) (2010-06-19)
[2 later articles]
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Wed, 16 Jun 2010 22:12:09 +0000 (UTC)
Organization: Aioe.org NNTP Server
References: 10-06-032
Keywords: interpreter
Posted-Date: 17 Jun 2010 13:18:54 EDT

glen herrmannsfeldt <gah@ugcs.caltech.edu> wrote:
(snip)


> 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?


And our moderator wrote:


> [Seems to me that if you disqualify compilers because they generate
> calls to runtime libraries, you'll have precious few compilers left.
> Having hacked a certain amount on the old Unix threaded code Fortran
> system, the compiler was definitely a compiler, parsed the source
> code, made a symbol table, and generated object code. The stuff that
> the threaded code called was an interpreter. -John]


Still trying for a productive answer to an admittedly unproductive
question, and following the discussion in the wikipedia entry
for "Threaded_code", they make the distinction of direct threaded,
indirect threaded, and subroutine threaded.


Even more, it seems that:


    "Ertl's most recent tests show that direct threading is the
      fastest threading model on Xeon, Opteron, and Athlon processors;
      indirect threading is the fastest threading model on Pentium M
      processors; and subroutine threading is the fastest threading
      model on Pentium 4, Pentium III, and PPC processors."


It isn't so obvious how you distinguish subroutine threaded code from
other calls to the runtime library. (Not counting explicit calls such
as to intrinsic funtions, and even though such functions might be
expanded inline.)


Fortran READ and WRITE statements, the ** operator, and complex
division, are often implemented as subroutine calls, though with no
explicit call syntax. Some systems will generate subroutine calls for
all floating point operations, or even larger integer operations. And
then there is subroutine threaded code with subroutine calls for all
operations.


So where do you draw a line between "true compiler" and "just an
interpreter?"


-- glen



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.