Version

Grammar Overview

Topic Overview

Purpose

This topic provides an overview of the Syntax Parsing Engine’s Grammar.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic provides an overview of the Syntax Parsing Engine.

In this topic

This topic contains the following sections:

Grammar Overview

Grammar summary

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.LexerStates – The collection of LexerState instances, which each have a Symbols collection, all of which collectively contain the terminal symbols of the 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.

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains the grammar analysis performed by the Syntax Parsing Engine.

The topics in this group explain the lexical analysis performed by the Syntax Parsing Engine.

This topic explains the syntax analysis performed by the Syntax Parsing Engine.