How to write a toy interpreter

Hi,

I was reading today this post [1], and i would like to write my own
toy interpreter. The simplest example possible (with or without ruby).

Can anyone recommend me some start points ? (URLs, tutorials, or books )

Thanks.

[1] : http://code.google.com/p/cat-language/wiki/HowTheInterpreterWorks

Pedro Del G.

Email : [email protected]

On Mon, Apr 09, 2007 at 02:37:46AM +0900, Pedro Del G. wrote:

I was reading today this post [1], and i would like to write my own
toy interpreter. The simplest example possible (with or without ruby).

Can anyone recommend me some start points ? (URLs, tutorials, or books )

An excellent book for everything about language parsing and code
generation
is “Compilers: Principles, Techniques and Tools”

A toy interpreter is part of the test suite for Dhaka (a parser
generator -
http://dhaka.rubyforge.org). There’s even a page documenting the
interesting
bits:

http://dhaka.rubyforge.org/chittagong.html

The whole interpreter is about 300 lines of code.

Mushfeq.