2
$\begingroup$

Can anyone recommend a good textbook for writing interpreters (not compilers) that don't use languages like Scheme or Haskell?

$\endgroup$

closed as too broad by Aurora0001, Jay, Kevin Workman, ItamarG3, Ellen Spertus Sep 22 '17 at 23:59

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Since the difference between a compiler and an interpreter is actually very small, most good compiler books will give you the basis. The difference is only in the back end where an execution engine replaces the code generator. The front and middle sections are the same: scanning, parsing, semantic analysis, maybe some optimization. It may even create intermediate code and work from that. Otherwise from the parse tree usually. $\endgroup$ – Buffy Sep 21 '17 at 20:52
  • $\begingroup$ And welcome to CSEducators. $\endgroup$ – Buffy Sep 21 '17 at 21:21
  • $\begingroup$ Can you give some more context about the age of the students, the previous experience, the environment, etc? Also, welcome! $\endgroup$ – thesecretmaster Sep 21 '17 at 21:56
0
$\begingroup$

For the "intermediate code" version of an interpreter there is no finer example in a small book than On Pascal Compilers by Per Branch Hansen. You need to be able (or a least willing) to read Pascal of course.

This book is a rare instance of CS Literature. Hansen is one of the masters.

The way the code in the book is developed you actually see the difference between compiling and interpreting as he does "code generation" to an intermediate language and then provides a separate interpreter for that language. So you see what you need to do to get to the point at which interpretation is efficient and then see how the interpreter part actually works.


The book is out of print. Check around for a used copy. Amazon currently has it a bit cheaper than Abe Books. If you have a good University Library nearby they may have it. You might also be able to get a copy from interlibrary loan that is supported by most libraries.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.