Re: Advice needed: book on interpreter construction

brianmcg@interaccess.com (Brian V. McGroarty)
31 Dec 1995 12:06:32 -0500

          From comp.compilers

Related articles
Advice needed: book on interpreter construction ibmstuff@sccsi.com (1995-12-30)
Re: Advice needed: book on interpreter construction brianmcg@interaccess.com (1995-12-31)
Re: Advice needed: book on interpreter construction ph@anweald.exnet.co.uk (Patrick Herring) (1996-01-12)
Re: Advice needed: book on interpreter construction martelli@cadlab.it (1996-01-12)
Re: Advice needed: book on interpreter construction bernecky@eecg.toronto.edu (1996-01-14)
Re: Advice needed: book on interpreter construction lhf@csg.uwaterloo.ca (1996-01-15)
Re: Advice needed: book on interpreter construction fburton@nyx10.cs.du.edu (1996-01-27)
Re: Advice needed: book on interpreter construction sy73343@vantage164.vantage.fmr.com (1996-01-31)
| List of all articles for this month |

From: brianmcg@interaccess.com (Brian V. McGroarty)
Newsgroups: comp.compilers
Date: 31 Dec 1995 12:06:32 -0500
Organization: Internet Squire
References: 95-12-157
Keywords: interpreter, books

> [...] I'm
>looking for a good book that deals with interpreters--I've got several
>compiler books but they aren't really much help. A book with example
>code (even fragments) would be very useful as I'm in a big hurry.
>
>[I compile to byte codes or a tree and then interpret that, keeping
>intermediate results on a stack. It's easier than compiling for a
>real machine mostly because you can change the target machine to make
>it easier to compile for. -John]


If you need to do something approximating John's suggest quickly, you could
simply bastardize Lex to substitute subroutine pointers for tokens, build
tree of same and traverse the tree. To keep things simple, you may want to
forgo the implementation of any control structure and simply traverse the
tree once per data record. If your record names and types are always the
same, this too could be hard-coded with offsets to an array of pointers to
the data structures to shorten implementation time.
  Compiler Design in C (Allen Holub, ISBN 0-13-155045-4) includes a complete
discussion of Lex as well as source for what seems a more straightforward
version of same -- this might be the best reference for what you're trying
to do.


---
Brian V. McGroarty -- brianmcg@bix.com -- phone/fax (708) 439-7714*
*(847) 439-7714 as of 1/20/96
--


Post a followup to this message

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