Structures
The following structures are available globally.
-
An
ItemKey
designates a part of the input that has been successfully parsed as a certain symbol with certain parameters.Seealso
ConstructResultDeclaration
Swift
public struct ItemKey<Param> : Hashable where Param : Hashable
-
Represents a rule of the grammar.
A rule is similar to a rule in a context-free grammar, and has the form
L => R1 ... Rn
where
L
is the left-hand side of the rule, andR1 ... Rn
is the right-hand side of the rule.Unlike the rules of a context-free grammar though, each of the symbols
L
,R1
, …,Rn
carries an input and an output parameter with them. The propertyeval
(in tandem with the propertyinitialEnv
) is responsible for computing these parameters along the stages of the parsing process.Furthermore, the symbol
L
does not have to be a nonterminal, but can also be a terminal symbol. In this case, the invocation of this rule during parsing spawns a separate parsing process with a grammar identical with the current grammar, except thatL
is now treated as a nonterminal symbol. This enables a form of scannerless parsing.Seealso
GrammarSeealso
EvalFuncDeclaration
Swift
public struct Rule<Param>
-
The result of parsing a terminal (either via a lexer or via rules).
See moreDeclaration
Swift
public struct Token<Param, Result> : Hashable where Param : Hashable
-
A
See moreTerminalKey
is used to distinguish which terminal and input parameter are under consideration.Declaration
Swift
public struct TerminalKey<Param> : Hashable where Param : Hashable