Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Foundations of programming languages (2nd ed.)
Lee K., Springer International Publishing, New York, NY, 2017. 370 pp. Type: Book (978-3-319707-89-1)
Date Reviewed: Apr 8 2019

Programming is a science-based craft. For a programmer, the better the science, the better the craft. Foundations of programming languages provides a computer science (CS)-based treatment of the foundations of three programming paradigms: imperative programming (including object-oriented programming), functional programming, and logic programming. These paradigms are illustrated by focusing on a small set of programming languages: assembly (expressed as Python bytecode), Java, C++, ML, and Prolog. From the science side, topics include compilation, interpretation, virtual machines, types, type checking, Backus–Naur form (BNF) and extended BNF, context-free grammars, derivations, parse trees, lexical analysis, parsing, and top-down and bottom-up parsers. The discussion of functional programming includes a brief introduction to the lambda calculus.

The thread guiding the discussion is JCoCo, a stack-based “virtual machine, or interpreter, for bytecode instructions.” JCoCo “mimics a subset ... of the Python 3.2 virtual machine” and “provides an interactive command-line debugger,” which can be used to trace and debug programs written in JCoCo bytecode. JCoCo reads a file of assembly language instructions and builds “an internal representation of the program as a sequence of functions, each with their own sequence of bytecode instructions.” JCoCo is written in Java.

JCoCo includes a disassembler for the JCoCo virtual machine:

A disassembler is a tool that will take a machine language program and produce an assembly language version of it. Python includes a module called dis that includes a disassembler. When you write a Python program it is parsed and converted to bytecode when read by the interpreter. The dis module disassembler produces an assembly language program from this bytecode. JCoCo includes its own disassembler which uses the Python dis module and produces output suitable for the JCoCo virtual machine. (p. 58)

The justification for creating JCoCo is that the Python virtual machine, “an internal component of the Python interpreter,” is not available for separate use. JCoCo serves to learn assembly language “by examining Python code and learning how it is implemented in assembly language.” This is how JCoCo is used in this book. Source code for a reduced functionality JCoCo is available free of charge. Appendix A of the book lists the JCoCo virtual machine specification.

The first edition of the book used CoCo, an earlier and less powerful virtual machine, written in C++. Also, while the second edition compares and contrasts the object-oriented features of Java versus C++, the first edition covered only C++. Otherwise the contents are similar. Please refer to Marlin Thomas’ enthusiastic review of the first edition for a thorough summary of the contents [1]. Here, I will simply concentrate on my observations about the second edition.

Foundations of programming languages (2nd ed.), intended to be used interactively in class, allows for extended projects outside of class. Working on at least some of these projects is essential to fully grasp the material presented. The format and depth of the material presented in class will be heavily dependent on the choices made by the instructor; each of the topics included in this book are, after all, usually covered more thoroughly in more narrow textbooks and separate classes.

Chapter 6 describes the implementation of Small, which is a not-so-small subset of ML, using JCoCo as the target language. The code to do this is available online (https://github.com/kentdlee/MLComp).

The intended audience is students who have some experience with object-oriented languages. Prior exposure to functional programming, logic programming, or compilation theory and techniques is not assumed. For this audience, many of the author’s excellent observations and insights may be more nebulous than enlightening, and some exercises extremely challenging. In this regard, the two-page bibliography given is minimally adequate.

This may be a book more effectively used with students who are further along in their studies, including ideally some acquaintance with functional programming through ML or Haskell. To fully grasp functional and logic programming, especially in contrast with procedural and object-oriented programming, what is needed is more than what this book provides: exposure to the underlying concepts and their compiler implementation. What is needed is actual programming experience that builds familiarity, intuition, and a bare-bones intimacy with both concepts and techniques.

For self-study, this would be an excellent book for programmers with a few years of professional experience with any sort of programming environment.

The book does not have an index, which is a major shortcoming. However, its website includes a welcome errata and other supplementary material (https://kentdlee.github.io/PL/build/html/index.html#).

Reviewer:  Edgar R. Chavez Review #: CR146519 (1906-0210)
1) Thomas, M. Review of Foundations of programming languages, by Kent D. Lee. Computing Reviews (July 20, 2015), CR Rev. No. 143629 (1510-0856).
Bookmark and Share
  Reviewer Selected
Featured Reviewer
 
 
Formal Definitions And Theory (D.3.1 )
 
 
Language Classifications (D.3.2 )
 
 
Language Constructs and Features (D.3.3 )
 
Would you recommend this review?
yes
no
Other reviews under "Formal Definitions And Theory": Date
Higher-order Horn clauses
Nadathur G., Miller D. (ed) Journal of the ACM 31(4): 777-814, 1984. Type: Article
Jul 1 1991
Properties of data flow frameworks
Marlowe T., Ryder B. Acta Informatica 28(2): 121-163, 1990. Type: Article
Aug 1 1992
Programming languages and their definition
Bekic H., Jones C., Springer-Verlag New York, Inc., New York, NY, 1984. Type: Book (9789780387133782)
Jul 1 1985
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy