Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Formal languages and compilation (2nd ed.)
Reghizzi S., Breveglieri L., Morzenti A., Springer Publishing Company, Incorporated, New York, NY, 2013. 451 pp. Type: Book (978-1-447155-13-3)
Date Reviewed: Oct 8 2014

The relationships and equivalences between formal language categories and the different models of automata are among the deepest and most beautiful results in theoretical computer science. Given that the construction of programming language compilers and interpreters is one of the foremost applications of formal languages and their grammars (context-free grammars, to be more specific), their combination in a single volume comes naturally. This is exactly what Reghizzi and his colleagues from the Politecnico di Milano have done in their textbook for graduate and senior undergraduate computer science students.

Their book basically consists of four elaborate chapters that follow an unusually short introduction, without the typical fluff that plagues too many introductory chapters, something that their readers will surely appreciate.

Chapter 1 is focused on the syntax of languages. Its 90 pages discuss the aspects of formal language theory that are more relevant for the construction of compilers, namely regular expressions and context-free grammars. Apart from the common content you can find in any of the many good textbooks that exist on automata theory, students will also find an interesting section that includes a short catalog of common language ambiguities and proposes ways to resolve them in order to obtain unambiguous languages suitable for deterministic parsing. Despite their clear and understandable focus on deterministic languages, they conclude their chapter with a short section on the Chomsky hierarchy, the standard classification of formal grammars, language families, and computation models.

In chapter 2, the authors delve into the details of regular language recognizers. Shorter than the previous one, it introduces the details of deterministic and nondeterministic finite automata. In just 50 pages written with great care and rich in detail, readers will discover the correspondence between linear grammars and finite automata, learn how to convert an automata into a regular expression using the Brzozowski and McCluskey algorithm, and how to perform the inverse conversion using Thompson’s structural method or the Berry and Sethi algorithm.

The next chapter is the core of the book: 150 pages on parsing context-free grammars, mainly for deterministic languages so that parsing can be performed in linear time. The chapter studies pushdown automata from a formal point of view before delving into the details of deterministic parsing algorithms. These algorithms are presented for context-free grammars in extended Backus-Naur form (EBNF), a distinctive feature of this textbook with respect to other compiler textbooks. Unfortunately, this choice might not be the most desirable from a pedagogical point of view, since it makes the content harder to understand for those without a suitable background (and those with such background might find too much of the previous material superfluous or even redundant).

Apart from the top-down and bottom-up algorithms for parsing deterministic context-free grammars in EBNF, that is, ELL and ELR parsers, the authors also include a description of Earley’s parsing algorithm for arbitrary context-free grammars, which runs in cubic time for arbitrary context-free grammars, in quadratic time for unambiguous context-free grammars, and in linear time for most LR(k) grammars. They also include a section describing a parallel parsing algorithm for Floyd’s operator-precedence grammars based on their own research results. Finally, they conclude their discussion on parsing with some final notes on managing syntactic errors and incremental parsing, two aspects that should be considered from the start by those building compilers and parser generators.

Chapter 4, “Translation Semantics and Static Analysis,” basically contain all of the basic material that is needed to complete the front end of a working compiler but was not discussed in the previous three chapters. Its first three quarters, focused on translation, discuss syntactic translation by finite transducers for regular languages and pushdown transducers for context-free grammars, as well as attribute grammars, the method of choice for compiler designers.

Synthesized and inherited attributes are referred to as left and right attributes in attribute grammars. Performing semantic checks, code generation, and semantics-directed parsing are briefly described as the archetypical applications of attribute grammars. The final section of this chapter turns the reader’s attention to static program analysis. Without intending to be exhaustive, a mere score of pages introduce data flow equations and illustrate how they are used to analyze variable liveness and reaching definitions. The former eases memory allocation by detecting “interferences” and allows the identification of useless definitions (useful for optimization and warning of potential programming mistakes), while the latter is also used in program optimization (for example, constant propagation) and the identification of potential problems (that is, the bad initialization of variables).

There is an abundance of excellent textbooks on both automata theory, such as [1] and [2] (although some might still prefer the original edition [3]), and compilers, including the well-known dragon [4], ark [5], and whale [6] textbooks. Hence, it is difficult for newcomers to obtain a significant share of the textbook market within two of the most established subfields in computer science. However, this self-contained textbook might still be a good alternative if tight schedule constraints in squeezed computer science curricula force students to be acquainted with both automata theory and compilers in a single-semester course.

Reviewer:  Fernando Berzal Review #: CR142809 (1501-0017)
1) Sipser, M. Introduction to the theory of computation (3rd ed.). Cengage Learning, Boston, MA, 2012.
2) Hopcroft, J. E.; Motwani, R.; Ullman, J. D. Introduction to automata theory, languages and computation (3rd ed.). Addison-Wesley, Boston, MA, 2006.
3) Hopcroft, J. E.; Ullman, J. D. Formal languages and their relation to automata (1st ed.). Addison-Wesley, Boston, MA, 1969.
4) Aho, A. V.; Lam, M. S.; Sethi, R.; Ullman, J. D. Compilers: principles, techniques & tools (2nd ed.). Addison-Wesley, Boston, MA, 2007.
5) Cooper, K. D.; Torczon, L. Engineering a compiler (2nd ed.). Morgan Kaufmann Publishers, Burlington, MA, 2011.
6) Muchnick, S. S. Advanced compiler design and implementation. Morgan Kaufmann, Burlington, MA, 1997.
Bookmark and Share
  Reviewer Selected
Featured Reviewer
Formal Languages (F.4.3 )
Automata (F.1.1 ... )
Would you recommend this review?
Other reviews under "Formal Languages": Date
The three subfamilies of rational &ohgr;-languages closed under &ohgr;-transduction
Timmerman E. Theoretical Computer Science 76(2-3): 243-250, 2001. Type: Article
Jul 1 1992
Introduction to formal languages
Révész G., Dover Publications, Inc., New York, NY, 1991. Type: Book (9780486666976)
Jan 1 1993
Fibonacci morphisms and Sturmian words
Séébold P. Theoretical Computer Science 88(2): 365-384, 1991. Type: Article
Oct 1 1992

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