Macros
Generate a non-terminal symbol from a string.
Represents a rule that replaces one non-terminal by a sequence of non-terminals. Invoke it like this:
Represents a disjunctive rule: a non-terminal that can be replaced by one of the listed terminal symbols. An invocation of this macro looks like this:
Structs
A derivation starts with the starting non-terminal symbol of the grammar and progresses by iteratively replacing non-terminals by some sequence of symbols, according to the grammar rules.
An expression constituted of a sequence of terminal symbols. These
expressions can be obtained by making a complete Derivation with the
Grammar. A Derivation that has only terminal symbols can be
converted into an expression.
Represents a context-free grammar. Contains a NonTerminal which
represents the starting symbol and a list of Rules.
A non-terminal symbol is a symbol that must be replaced further before the final expression is complete.
Represents a grammar rule. Contains a NonTerminal which represents the
rule’s head, and a RuleBody.
A terminal symbol is a symbol that is not further replaceable. It can appear in the final expression generated.
Enums
A Symbol can be a Terminal (a symbol that can appear in the final
expression generated by the grammar) or a NonTerminal (a symbol that
must be replaced further).