Related articles |
---|
Threaded Interpreter acampbellb@hotmail.com (Avatar) (2005-11-19) |
Re: Threaded Interpreter anton@mips.complang.tuwien.ac.at (2005-11-21) |
Re: Threaded Interpreter egagnon@sablevm.org (Etienne Gagnon) (2005-11-21) |
Re: Threaded Interpreter jeffrey.kenton@comcast.net (Jeff Kenton) (2005-11-21) |
Re: Threaded Interpreter gowrikumar_ch@yahoo.com (chandramouli gowrikumar) (2005-11-21) |
Re: Threaded Interpreter ian.rogers@manchester.ac.uk (Ian Rogers) (2005-11-21) |
Re: Threaded Interpreter dave@mips.complang.tuwien.ac.at (2005-11-27) |
From: | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
Newsgroups: | comp.compilers |
Date: | 21 Nov 2005 22:41:06 -0500 |
Organization: | Institut fuer Computersprachen, Technische Universitaet Wien |
References: | 05-11-091 |
Keywords: | interpreter |
Posted-Date: | 21 Nov 2005 22:41:06 EST |
"Avatar" <acampbellb@hotmail.com> writes:
>I am searching for reference implementations of a threaded interpreter
>(as opposed to the traditional switch dispatch method).
For a trivial implementation, look at my interpreter dispatch
micro-benchmark:
http://www.complang.tuwien.ac.at/forth/threading/
For something a little more substantial, you could look at the
examples provided with Vmgen
<http://www.complang.tuwien.ac.at/anton/vmgen/>. Since Vmgen is
distributed with Gforth, you also get a full-size threaded-code
interpreter with additional optimizations.
Finally, you can look at full-size interpreters like Gforth, SableVM,
the Ocaml "bytecode" interpreter, YAP or Sicstus Prolog.
>There was a long thread in comp.compilers some years back about how you
>could write fairly machine independent threaded C code using some gross
>hacks. -John]
No gross hacks needed, just the labels-as-values feature supported by
gcc and a number of other C compilers.
Fortran also supports this feature (under the name "assigned goto"),
so writing a threaded-code interpreter in Fortran should be possible.
- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/home.html
Return to the
comp.compilers page.
Search the
comp.compilers archives again.