Subj : Re: How-to on writing an interpreter? To : comp.programming From : Flavius Vespasianus Date : Mon Jul 18 2005 04:09 am "C. Rebert" wrote in news:1121485564.371721.318960 @g43g2000cwa.googlegroups.com: > I'm trying to implement an interpreter for a programming language, but > so far haven't been able to find any good materials on how to write a > simple stack-based interpreter. I would appreciate it if someone could > point me to some resources on writing such an interpreter. I'd be open > to buying such materials, as long as they aren't ludicrously expensive. > Thanks for your time. There are about 5 books on compilers and interpreters available on Amazon. (Apparently Aho et all have a new compiler book coming out in Nov.) Having done it many times, I will give a brief outline..... The basic process is to define the language and to define the intermediate structure to be interpreted. The latter will be symbol tables and trees/graphs representing the code to execute. (OO languages, such as C++ are EXTREMELY well suited for such applications) Then you have to write a parser to convert the language into the intermediate form. Then you have to write the interpeter itself that "execute" the intermediate form. A good compiler book(even one that did not specifically deal with interpreters) is what you need to learn. .