|
|
Parser and Grammar Examples
Perhaps the best way to learn any technology is by studying examples of how
it can be used to solve actual problems. The ProGrammar installation includes
many example parsers, some of which are meant to demonstrate key features of
GDL, while others are practical grammars that can be used by
your programs.
Tutorial Examples
The following examples are referenced throughout the ProGrammar documentation,
and are used to demonstrate particular aspects of GDL and the API. They are listed
in order of increasing complexity.
|
Phonebook
|
Parses names and phone numbers. Introduces the basic concepts of writing grammars.
|
|
Dates
|
Parses several different date formats. Demonstrates how to use disjunction (logical-OR) to declare alternate ways of parsing a symbol. Also introduces symbol attributes.
|
|
CSV
|
Parses comma-separated values. Introduces the SPACE attribute and regular expressions.
|
|
JustFax
|
Parses fax numbers from unformatted text messages. Demonstrates how to use wildcards for locating text.
|
|
RegExp
|
Parses examples of regular expressions.
|
|
Expression
|
Parses arithmetic expressions. Demonstrates how to use recursive productions and implementing precedence rules. There's example C++ and Visual Basic source code, located under the project directory, that uses the API to evaluate those expressions.
|
|
SQL
|
Subset of SQL
|
|
MiniGram
|
Parses a mini-programming language. Uses concepts involved in writing grammars for high-level languages. The complete source code, for Visual C++ and Visual Basic, is provided for implementing an interpreter for the MiniGram language.
|
Related Topics
"Ready-to-use" Grammars
|