Introduction

parsing.pp - A library of basic parser classes useful in larger projects.
Copyright (C) 2014-2015 Michael Malicoat.
Home page | Source | Source documentation (you're looking at it) | Bug tracker

Overview

The parsing library found along with this file is designed to provide an object-oriented approach to a recursive-descent parser. While there are many arguments for and against recursive-descent parsers vs. table-driven parsers, the fact remains that recursive-descent parsers are easier to implement, which is why the design and implementation of such a parser is often used as an educational tool. But recursive-descent parsers are not limited to the educational environment; they also enjoy wide use in several "real-world" situations. Although parsing.pp codes for a recursive-descent parser, an examination of the source should reveal that it is written in such a way that constructing a table-driven parser should require fairly little effort on the part of the programmer who desires one.

The library defines several classes to handle:

How to use the parsing library

This file is not meant to be a reference on how to build a parser, although you can learn how this one is built by looking at the source code and associated documentation. There are several books available that can take you through the design and implementation of a parser; the book Writing Compilers and Interpreters by Ronald Mak helped to shape the early design of the parser contained here.

A practical example of how the parsing library can be used to parse a language can be found in the series of articles I've written that deal with writing a parser to parse the command-line arguments passed to a program. You can also refer to the source for LinearC to see how it all comes together.

The documentation seen here was generated with a modified version of PasDoc. The classes hierarchy graph was generated using GraphViz.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License or, at your option, any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABLITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

References

(Not visible in the parsed HTML output because they've turned into the various links used in the text above.)


Generated by PasDoc 0.13.0 on 2015-06-25 11:12:03