On 9 Feb 2012 at 13:13, Nigel Williams wrote:
The PDP-11 FORTRAN-IV compiler generated code this
way, it was called
"threaded code", and the resultant binaries straddle the boundary
between "native code" and interpreted code. RBK Dewar (ACM 1975) makes
the distinction between indirect and direct threaded code, noting that
the PDP-11 FORTRAN-IV compiler generated direct-threaded code -
"linear list of addresses of routines to be executed". I feel a strict
definition of native code is complicated since it is necessary to
place it in time as well as extent; microcoding, writable control
stores, extensible instruction sets complicate the definition.
Sure. And long before Bob wrote his article it was standard practice
across a lot of platforms to use threaded code (I think of FORTH as
the archetype).
And there are other shades of emulation/native code.
Getting on 40 years ago, I wrote a compiler in assembly that was
implemented in an artifical "compiler language". Macros generated
the instructions (all one word long) and an interpreter coded in
FORTRAN. The idea was to abstract common items such as tokens,
numerics, symbol table management, etc. and get the thing emitting
code with lots of sanity checking built in. The result was very
slow, but correct compilation implemented in a very short time.
The macros were then recoded to native machine code, with calls to
support routines written in assembly. to handle the more involved
operations, such as symbol table operations and I/O. The result was
a very fast compiler, essentially written in assembly, but something
that could, simply by changing the environment, could be changed back
to an emulated basis.
--Chuck