|Help wanted - getting started writing an interpretter firstname.lastname@example.org (SynapZ) (2001-09-21)|
|Re: Help wanted - getting started writing an interpretter monnier+comp.compilers/news/@RUM.cs.yale.edu (Stefan Monnier) (2001-09-25)|
|Re: Help wanted - getting started writing an interpretter email@example.com (Joachim Durchholz) (2001-09-25)|
|Re: Help wanted - getting started writing an interpretter firstname.lastname@example.org (2001-09-26)|
|From:||"Joachim Durchholz" <email@example.com>|
|Date:||25 Sep 2001 00:13:47 -0400|
|Posted-Date:||25 Sep 2001 00:13:47 EDT|
SynapZ <firstname.lastname@example.org> wrote:
> I'm writing a simple script language for a game I'm making and I've
> been reading up on the area (never written a compiler before!). I've
> decided to create a compiler with lex/yacc that produces a condense
> bytecode output, to be interpretted by the game. Does this sound like
> a sensible approach (small footprint target so need to keep compiled
> scripts as small as possible) ?
Well, modulo the general "Don't Do That"... it's rarely worth the
effort. OTOH your language is so minimal that a specialized interpreter
might indeed be more compact than a general solution... but I'd still
first try with an existing interpreter and look whether it's good
> I'm fairly confident that I can make the compiler with the help of lex
> and yacc but the interpretter seems to be a completely separate issue.
> Are there any tools out there to help automate this process (i.e.
> generate an interpretter for a lex/yacc'd language)?
You still have to write semantic actions on yacc, I don't think any tool
will help you with that. These actions would either produce a parse
tree, or generate byte code directly, depending on how much in the way
of code transformation etc. you're going to do.
However, the following might help you with writing the bytecode
Vmgen will take C code and a bit of metainformation for each
instruction, and generate a VM for you. (At least that's what I
understood from the docs, I haven't used it yet.)
Return to the
Search the comp.compilers archives again.