Updates

Latest Tweet



What's New?

Check out for latest innovation, a computer based training video collection


Like this Page

Building Parsers With Java(TM) Review by calvinnme

Good practical book on building parsers

This book does not assume that you understand compilers or programming language theory. However, the beauty and eloquence of what the book is trying to teach you will be far clearer if you do understand these disciplines. This book teaches you how to build nondeterministic recursive-descent parsers. If you are interested in other kinds of parsers, then you need to consult another source. The classic source on these other kinds of parsers is "Compilers: Principles, Techniques, and Tools" by Aho, also known as "The Dragon Book".

This book explains how to write parsers for new computer languages that you create. Each chapter focuses on either background, techniques, or applications. A chart at the beginning of chapter one shows you which chapter focuses on each topic. Each chapter builds on the material presented in preceding chapters, so you should probably proceed through this book linearly. I review this book in the context of the table of contents:

1. Introduction - Just performs an overview of the book.
2. The Elements of a Parser - Explains what a parser is, introduces the building blocks of applied parsers, and shows how to compose new parsers from existing ones.
3. Building a Parser - Explains the steps in designing and coding a parser.
4. Testing a Parser - How to test a new language's features and also how to use random testing to detect ambiguity and other problems.
5. Parsing Data Languages - Shows how to create a parser that reads the elements of a data language. A data language is a set of strings that describe objects following a local convention.
6. Transforming a Grammar - How to ensure the correct behavior of operators in a language and how to avoid looping in a parser, which can follow from loops in a grammar.
7. Parsing Arithmetic - This chapter develops an arithmetic parser. Arithmetic usually appears as part of a larger language.
8. Parsing Regular Expressions - develops a regular expression parser. A regular expression is a string that uses symbols to describe a pattern of characters.
9. Advanced Tokenizing - Describes the tokenizers that are part of the Java programming language as well as the customizable tokenizer of this particular book. Tokenizing a string means breaking the string into logical nuggets so that you can define your parser in terms of these nuggets rather than individual characters.
10. Matching Mechanics - Explains how the fundamental types of parsers in this book match text.
11. Extending the Parser Toolkit - How to extend a parser toolkit which includes introducing new types of terminals or completely different parser types.
12. Engines - Introduces a logic engine, which is a piece of software that is able to return objects and groups of objects in response to a logical query.
13. Logic Programming - Shows how to program with facts and rules.
14. Parsing a Logic Language - How to construct a parser for a logic language. It shows how to build a parser for the Logikus programming language that was introduced in the previous chapter.
15. Parsing a Query Language - Constructs a parser for a query language. A query language parser translates textual queries into calls to an engine. The engine proves the query against a source of rules and data and returns successful proofs as the result of the query.
16. Parsing an Imperative Language - Shows how to create a parser for imperative languages. An imperative language parser translates a textual script into a composition of commands that direct a sequence of actions.
17. Directions - Points out areas for further reading and programming.

I used this book to create a parser for a visual language, and I found the instructions in this book very complete and helpful. I would recommend the following books if you are interested in getting deeper into the theory behind this book - "Programming Language Pragmatics" and also "Introduction to the Theory of Computation" by Sipser.