Grammatica Reference Manual
Terms & Definitions
Grammatica uses a specific terminology that is important to
understand. Those same terms are also used in this reference
manual and in other documents. The list below attempts to define
and describe the most important terminology for Grammatica.
-
Grammar
A definition of a language. For Grammatica only
context-free grammars for artificial languages are considered.
A grammar is defined by a set of tokens and productions.
-
Token
A token groups a set of characters together, much like a
word in a natural language. A production contains tokens and
references to other productions as building blocks. A token
definition is normally made in the form of a regular
expression.
-
Regular Expression
A simple language for defining a set of character
sequences. Used to define tokens in the grammar.
-
Production
A rule in the grammar. Each production consists of a set
of production alternatives.
-
Production Alternative
A sequence of references to either tokens or
productions. Each production has at least one production
alternative.
-
Parse
The process of reading and analyzing a character stream.
A parser is a program that can read input characters and
analyze them according to some grammar.
-
Parse Tree
A tree structure formed during the parsing. Each
production and token used in the parsing is present in the
tree, in the hierarchical order in which they were
found.
-
Syntax Tree
Similar to a parse tree. Often the term abstract syntax
tree (AST) is used instead of parse tree, although the
abstract syntax tree is possibly modified after
parsing.