Bill Kelly wrote:
>
> I am trying my hand at rewriting it, although still in straight 'C'.
Hi Bill,
You may have a look at Anton Ertl's vmgen, a generator for virtual machines.
As the name says, it's intended to be used for bigger things than 'just' RE,
but if it's good for big things, i suppose it may be good for 'small'
things. Maybe it's overkill, I don't know.
vmgen provides some infrastructure below the interpreter:
* disassembling
* tracing
* profiling
* optimizations (top-of-stack-caching, automatic generation of
superinstructions based on profiling data, ...)
You only have to specify the instructions (in C) plus their stack effect in
a description file and vmgen will generate the interpreter for you. Register
based VM, stack based VM, VM based on as many stacks as you want, ...
Anton Ertl uses it to build the engine for Gforth, AFAIK the fastest one
that is also portable. That means, relative portable; not beyond gcc, because it
uses lable-as-address, a gcc extension to the standard.
vmgen is included in the latest snapshot of Gforth:
http://www.complang.tuwien.ac.at/anton/vmgen/gforth-0.5.9-20010501.tar.gz
and a paper about it:
http://www.complang.tuwien.ac.at/anton/vmgen/paper.ps.gz
There is not yet a manual, but an example interpreter for a 'mini' language.
regards
markus
--
-------------------------------------------------