The book Programming Language Concepts (PLC) covers basic concepts such as abstract syntax, interpretation, stack machines, compilation, type checking, garbage collection, and real machine code, as well as the more advanced topics on polymorphic types, type inference using unification, co- and contravariant types, continuations, and backwards code generation with on-the-fly peephole optimization. The book uses a functional programming language (F#) as metalanguage to present all concepts and examples, and thus has an operational flavour, enabling practical experiments and exercises.
Programming Language Concepts covers practical construction of lexers and parsers, but not regular expressions, automata and grammars, which are well covered elsewhere. It discusses the design and technology of Java and C# to strengthen students' understanding of these widely used languages.
The examples present several interpreters and compilers for toy languages, including compilers for a small but usable subset of C, abstract machines, a garbage collector, and ML-style polymorphic type inference. Each chapter has exercises. Complete example source files, lecture slides and other materials are available below.
The second edition includes two new chapters. One describes compilation and type checking of a full functional language, tying together the previous chapters. The other describes how to compile a C subset to real (x86) hardware, as a smooth extension of the previously presented compilers.
Table of contents for the second
edition.
Related lectures and example code
Chapter | Lecture slides | Example code, 1st ed | Example code, 2nd ed (updated 4 April 2021) |
---|---|---|---|
Chapter 1 and Appendix A | lecture01.pdf | intro.zip | intro.zip |
Chapter 2 | lecture02.pdf | intcomp.zip | intcomp.zip |
Chapter 3 | lecture03.pdf | expr.zip and usql.zip | expr.zip and usql.zip |
Chapter 4 | lecture04.pdf | fun1.zip and typedfun.zip | fun1.zip and typedfun.zip |
Chapter 5 and 6 and section A.11 | lecture05.pdf | fun2.zip | fun2.zip |
Chapter 7 | lecture06.pdf | imp.zip and microc.zip | imp.zip and microc.zip |
Chapter 8 | lecture07.pdf | microc.zip | microc.zip |
Chapter 9 | lecture08.pdf | virtual.zip | virtual.zip |
Chapter 10 | lecture08.pdf | listc.zip | listc.zip |
Chapter 11 | lecture09.pdf | cont.zip | cont.zip |
Chapter 12 | lecture10.pdf | microc.zip and ex13-code.txt | microc.zip and ex13-code.txt |
Chapter 13 | microsml.zip | ||
Chapter 14 | assembly.zip |
Order it from Amazon.com or Amazon.co.uk or straight from Springer.
Errata for the second edition.