|Crafting A Compiler||
Crafting A Compiler
|178.90||approx. 7-9 days|
A practical yet thorough treatment of compiler construction.
Crafting a Compiler is an undergraduate-level text that presents a practical approach to compiler construction with thorough coverage of the material and examples that clearly illustrate the concepts in the book. Unlike other texts on the market, Fischer/Cytron/LeBlanc uses object-oriented design patterns and incorporates an algorithmic exposition with modern software practices. The text and its package of accompanying resources allow any instructor to teach a thorough and compelling course in compiler construction in a single semester. Crafting a Compiler serves as an ideal reference and tutorial.
Use of modern object-oriented patterns (such as Visitor)
Many students are already familiar with object-oriented patterns, and these patterns tend to organize software in such a way that the resulting compliers are more clear and more easily understood, so their use throughout the book allows students to absorb the concepts more readily. For students who have not seen these patterns, their use in a compiler is a compelling example.
Example: Code generation is cast as a visit of the AST
Use of pseudocode in algorithms
This book offers superior coverage of the algorithms used in the front- and back-end of the compiler. Unlike other texts that can lead to frustration with a mix of detail and abstraction that can be confusing to students, this book patterns the pseudocode after popular algorithm texts, such as Cormen, Leiserson, Rivest that most students have seen before.
Example: Many algorithms in a compiler involve sets. Instead of using low-level data structures to represent sets, they are referenced in pseudocode as sets. Most languages include implementation of set operations, and those could simply be used for implementing the algorithms. Students and professors who wish to study the algorithms at a deeper level can devise more efficient data structures after the basic concepts have been studied.
Exercises as Knowledge-based Inquiry
Most chapters include exercises that are meant to inspire professor- or student-directed exploration. The authors find that such “knowledge-based inquiry” is more fun for students and leads to better retention of concepts. The text forms the foundation for such exploration, but the student and professors are guided into further study by these exercises.
Abstract Syntax Tree (AST) is a pivotal element of the exposition
The book is neatly divided into the phases that construct the AST and those that process the AST. In contrast with other books, the design and implementation of the AST is forefront in the text, and serves as a central element in type checking and code generation. Interfaces implemented by AST nodes trigger actions by the various compiler phases. As a result, students need not read or write as much code, and new elements are easily incorporated into the AST.
Example: Type checking can be implemented by visiting the tree and processing interfaces that specify how type rules apply to a given subtree. Semantic changes or additions can be implemented by changing these interfaces and their behavior in the visitors that process the AST.
Various components of the compiler can be provided to students so they can focus on the elements of particular interest in a given course offering.
Example: A front end could be given for parsing Java, and students can then focus on type checking or code generation. Or, students could develop and incorporate language extensions into the front end, with the back end mostly provided by the instructor.