|
|
Grammar Definition Language
Grammar Definition Language (GDL) is a high-level notation used to describe
the structure of data. A grammar is a set of rules that tells the parser how
to parse a given type of data. ProGrammar GDL has the following features:
|
Object-Oriented
|
GDL allows you to derive a grammar from other grammars.
Derived
grammars inherit all the symbols from their parents, and may selectively
override or extend them. This facilitates the creation of reusable
grammars that can be extended or modified as needed.
|
|
High-Level
|
GDL provides high-level constructs that simplify grammar development
by directly handling many parsing-related issues, such as:
 |
comparing upper and lower-case strings
|
 |
scanning whitespace
|
 |
skipping comments
|
 |
parsing fixed-length and variable-length tokens
|
 |
parsing common types of tokens, such as alpha and numeric
|
 |
parsing optional and repeating data elements
|
|
|
Programming Language-Independent
|
Programming language statements are not included in grammar
definitions, resulting in parsers that are programming language-independent,
less cluttered, and more reusable. Because GDL is language-neutral,
and parsers are developed independently of the applications that
use them, the same grammar can be used by all types of applications,
including C++, Visual Basic, and Delphi.
|
|
Advanced Features
|
GDL supports a number of advanced features.
 |
Using symbol attributes, each
production rule can control the behavior of the
parser in a context-dependent manner. For example, the
way in which whitespace is skipped can be tailored
for different sections of the input.
|
 |
Parse constraints allow the parser to make decisions
at runtime, based on the values of symbols that have already
parsed. Constraints are used to resolve ambiguities, simplify
certain types of grammars, and to enforce integrity rules
on the parse tree as it's being built.
|
 |
Various error handling primitives help the parser
to gracefully recover from syntax errors and to report them
in a meaningful way.
|
|
|
|