Re: Techniques for writing an interpreter (A Johnstone)
12 Mar 1998 23:14:08 -0500

          From comp.compilers

Related articles
Techniques for writing an interpreter (Simon Chapman) (1998-03-06)
Re: Techniques for writing an interpreter (Nick Roberts) (1998-03-08)
Re: Techniques for writing an interpreter (1998-03-12)
Re: Techniques for writing an interpreter (W. Craig Trader) (1998-03-15)
Re: Techniques for writing an interpreter (1998-03-15)
Re: Techniques for writing an interpreter (Peter Su) (1998-03-18)
Re: Techniques for writing an interpreter (1998-03-18)
Re: Techniques for writing an interpreter (Henry Spencer) (1998-03-18)
Re: Techniques for writing an interpreter (1998-03-18)
[23 later articles]
| List of all articles for this month |

From: (A Johnstone)
Newsgroups: comp.compilers
Date: 12 Mar 1998 23:14:08 -0500
Organization: Royal Holloway, University of London
References: 98-03-032
Keywords: interpreter, design

Simon Chapman ( wrote:

: All I really want to do is create an interpreter for my simple
: scripting language. Does anyone have any suggestions as to where I
: should start? Any pointers would be greatly appreciated.

Has anyone else noticed that everytime somebody asks a question like
this they get a load of responses saying - don't write another
language, use TCL (or something else). It comes to something when the
comp.compilers community is telling people not to write language
translators... ;-)

Something you might find useful is the latest version of our parser
generator RDP which comes with a couple of thick tutorial manuals. One
of them develops a sequence of single-pass interpreters (like the ones
you have made, I guess) and then goes on to develop a simulator and an
assembler for an extremely simple virtual machine along with two
compilers for that language: one a single pass compiler directly
outputing pseudo-machine code and a second one that builds an AST and
then walks it to spit out the assembler. Within this document you will
brush up against most of the stuff that you need to build
interpreters, assemblers, simulators and simple compilers.

The RDP 1.5 distribution makes all of these tools as part of the
installation and you get full source. RDP runs anywhere that you have
an ANSI C compiler and has been tested under a fleet of different
Unixes, MS-DOS and Windows. There are (apparently) Mac, Amiga and even
Archimedes users out there. Many RDP users have written to me saying
that they find it easy to use, so you might even be able to get
something up and running quickly. In any case, you might learn some
new stuff about byte codes and so on.

Look at


which has pointers to the ftp site
( and Postscript copies of the
manuals. The case study manual is still missing a couple of chapters
but it should be completed this week, subject to our departmental
refereeing process. The FTP site contains both DOS (windows) and Unix

Dr Adrian Johnstone, Senior Lecturer in Computing, Computer Science Dep,
Royal Holloway, University of London, Egham, Surrey, TW20 0EX, England.
Email Tel:+44(0)1784 443425 Fax:+44(0)1784 439786

Post a followup to this message

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