Chapter 0 - Introduction |
In this chapter we introduce this book. We apologize for writing another book about compiler construction because the world
does not need anymore books on this subject - except - this book is different - it is about writing compilers for little languages - a different class of programming languages. This book also stresses
practicality. It is our goal to not only tell you how it is done, but also to show you how it is done. |
Chapter 1 - An Introduction to Little Languages |
What makes little languages different from other kinds of programming languages? Why are little languages "more interesting"
than traditional programming languages? There are more little languages around than you might realize. This chapter introduces the concept of a little programming languages, and presents several examples of
these languages. |
Chapter 2 - Designing a Little Language |
Now that we have your interest in little languages, why not design your own special purpose little programming language?
This chapter describes how you go about designing your own little language. Design guidelines are given for designing little languages. |
Chapter 3 - Formal Considerations: Language and Grammars |
A great deal of theory had been created to support processing certain kinds of programming languages. After all, isn't a
programming language just another kind of data that is processed by a computer? This chapter describes some of the formal notions that support language processing. Its a little math, but it is really
interesting stuff. |
Chapter 4 - Lexical Analysis and Parsing |
Lexical analysis and parsing are steps one and two processing any programming language. Lexical analysis recognizes simple
elements in a programming language - like variable names and constants. Following lexical analysis comes parsing where statements in the language are recognized and special structures are built. Chapter 4
describes how this is accomplished. |
Chapter 5 - The Architecture of a Language Processor |
A language processor is a complex program. Like any complex program it is a good idea to have a plan for building the
program. In this chapter we describe the plan for building a language processor. |
Chapter 6 - Nodes and Pointers: Data Structures for the language processor |
We dig down deeper into the architecture of the language processor and describe the data structures supporting the language
processor we are developing. Data structures used in the language processor are described in detail in this chapter. |
Chapter 7 - Implementation of the Lexical Analyzer and Parser |
For our sample little language we now show the design and implementation of the lexical analyzer and the parser. The
algorithms are described in detail along with the C-language code that implements the algorithms. |
Chapter 8 - lex and yacc |
For the purest we have shown the precise C programs needed to create the lexical analyzer and parser for our sample
language. Alternatively these can be implemented using tools specifically for this purpose. Lex is a tool for creating lexical analyzers and Yacc is used to create parsers. Each has their own languages which
simplify the process of creating lexical analyzer and parsers. |
Chapter 9 - Executing the translated program: Interpretation and Compilation |
Even though we have built the necessary structures as the output of translation of our language, we still need to create
something to execute the instructions in the language. This can be accomplished by interpreting the translated program or by compiling the program. Both approaches are described in Chapter 9. |
Chapter 10 - Other Issues |
This chapter deals with several special topics including creating debugging tools, program editing, special extensible
languages, and English as a little language. |