Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
A practical approach to compiler construction
Watson D., Springer International Publishing, New York, NY, 2017. 254 pp. Type: Book (978-3-319527-87-1)
Date Reviewed: Aug 30 2017

Designing an undergraduate compiler construction textbook is difficult. The market is diverse, with different departments having quite different goals and diverse prerequisites for their courses. Although very few graduates of these programs will ever write a professional compiler, most of them will create processors that analyze some form of text. This slim volume (254 pages including the index) provides a good grounding for that task.

Watson begins with a short introduction that touches on what high-level languages are, how they can be processed, and why it’s important to study this area. He then spends about half the book (128 pages) on lexical analysis and parsing, covering both hand coding and generation via Flex and Bison. The treatment is pragmatic, with no theorems or proofs, but it makes the process understandable and covers practical necessities like error reporting and tree building.

The second half of the book samples semantic analysis, intermediate code, optimization, and code generation. Here the emphasis is on getting an overview of what could be done, rather than actually doing it. This is in sharp contrast to the first half of the book, but is compatible with the view that most readers will not be writing production compilers.

Finally, there is a ten-page chapter, “Implementation Issues,” that covers strategies such as cross-compilation, implementation languages, and portability. It also points out that a compiler is only one component of a programming language implementation, notes particular requirements for some systems, and speculates on future directions.

I found this book easy to read, with relevant examples and a good set of references. For me, its most interesting feature is the strategy used to support a particular audience: people who need to process text but will not write production compilers. The material itself has been standard for 30 years.

My only disappointment is the treatment of semantic analysis, which occupies ten pages of the 36-page chapter “Semantic Analysis and Intermediate Code” in the second half of the book. A paragraph in that chapter’s introduction summarizes management of names and types (the conventional tasks of semantic analysis), but those tasks are given short shrift in the chapter body. In particular, name analysis is described in terms of allocating storage to variables; there is no further mention of the problem of connecting uses of identifiers with their definitions. There are no references about name analysis listed for further reading, even though an abundance of material is available.

I regard this as a serious flaw, since many simple compiler-like processors need to deal with names but do not produce machine code. Storage allocation is not a semantic analysis task, and combining it with name analysis misleads the reader.

The purpose of the compiler phases through semantic analysis are to provide an abstract syntax tree that is decorated with whatever information is needed for subsequent processing.

Anyone who uses this book as a text should seriously consider providing a short supplement that describes name analysis in more detail and references available tools and techniques for carrying out semantic analysis in general.

Reviewer:  W. M. Waite Review #: CR145513 (1711-0700)
Bookmark and Share
  Reviewer Selected
 
 
Compilers (D.3.4 ... )
 
Would you recommend this review?
yes
no
Other reviews under "Compilers": Date
An architecture for combinator graph reduction
Philip John J., Academic Press Prof., Inc., San Diego, CA, 1990. Type: Book (9780124192409)
Feb 1 1992
Crafting a compiler with C
Fischer C., Richard J. J., Benjamin-Cummings Publ. Co., Inc., Redwood City, CA, 1991. Type: Book (9780805321661)
Feb 1 1992
A methodology and notation for compiler front end design
Brown C., Paul W. J. Software--Practice & Experience 14(4): 335-346, 1984. Type: Article
Jun 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