Programming Language Concepts

Cover

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

ChapterLecture slidesExample code, 1st edExample code, 2nd ed
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

Bibliographic data, second edition (2017)

P. Sestoft: Programming Language Concepts, Second edition, with a chapter by Niels Hallenberg. Springer Undergraduate Topics in Computer Science. xv + 341 pages. ISBN 978-3-319-60788-7. September 2017. The book's page at Springer. Front matter and back matter are freely available.

Order it from Amazon.com or Amazon.co.uk or straight from Springer.

Errata for the second edition.

Bibliographic data, first edition (2012)

P. Sestoft: Programming Language Concepts, Springer Undergraduate Topics in Computer Science. xiv + 278 pages. ISBN 978-1-4471-4155-6. July 2012. The book's page at Springer. Front matter and back matter is freely available.

Errata for the first edition.


Copyright (c) 2012, 2017 Peter Sestoft (sestoft@itu.dk) 2012-06-11, 2017-11-27