The grammar definition represents the structure to which documents must conform if they are to be considered correct. The Infragistics Syntax Parsing Engine supports context-free grammars, which are characterized with the following four items:
a set of terminal symbols, which are named textual elements
a set of non-terminal symbols, which are named sequences of symbols
a start symbol, which is the only non-terminal symbol which may exist at the root of the syntax tree
a set of productions, each of which indicates one way a non-terminal symbol can represent a sequence of symbols. In this case, symbols are either terminal symbols, non-terminal symbols, or both.
The grammar is represented by the Grammar class, defined in the Infragistics.Documents.Parsing namespace and as one would expect, there are properties on the grammar which relate directly or indirectly to all components of a context-free grammar:
Grammar.NonTerminalSymbols – The collection of non-terminal symbols of the grammar.
Grammar.StartSymbol – The non-terminal symbol which exists in the
NonTerminalSymbols collection and is the start symbol for the grammar.
NonTerminalSymbol.Rule – The root of a syntax rule tree which defines all the productions that have this owning non-terminal symbol as their head symbol.
The following topics provide additional information related to this topic.