Exploring Programming Language Architecture in Perl

Categories:

Recommended

By the end of this book you should have a thorough understanding of the inner workings of a programming language interpreter. The source code is presented in full, and several iterations add more features until it could be considered pretty complete. The interpreter is written to be as easy to understand as possible; it has no clever optimizations that might obscure the basic ideas, and the code and the ideas will be described to the best of my ability without any unexplained technical jargon. It is however assumed that you have a good working knowledge of Perl (Perl5), including its object-oriented features.

The final implementation will demonstrate:

  • primitive arithmetic operations;
  • conditional evaluation;
  • local variables;
  • functions and closure;
  • recursion;
  • list processing;
  • quote—preventing evaluation;
  • a simple macro facility;
  • variable assignment and side-effects;
  • procedures (as opposed to functions) and sequences;
  • objects and classes;
  • continuations;
  • threads;
  • exceptions;
  • non-determinism and chronological backtracking;
  • logic programming.

Having said that, time and space is not wasted fleshing the interpreter out with numerous cut’n’paste system interfaces, i/o or even much basic arithmetic (the final implementation has only multiplication, addition and subtraction—enough for the tests and examples to work,) but by then it should be a trivial matter for anyone to add those themselves if they feel so inclined. Another point worth mentioning up front is that no claims are made that this is in any way a production-quality or even an efficient implementation. It is just meant to be easy to understand.

Putting it another way, if you’ve come here looking for an off-the shelf scheme-like interpreter that you can use, you’ve come to the wrong place: there are many and better freely available implementations on the net. On the other hand, if you’re more interested in how such interpreters might work, I’d like to think that you might find what you’re looking for here.

 

Category:

Attribution

Bill Hails. Exploring Programming Language Architecture in Perl. http://www.billhails.net/Book/

VP Flipbook Maker

Convert your work to digital flipbook with VP Online Flipbook Maker! You can also create a new one with the tool. Try it now!