Structures
The following structures are available globally.
-
An
ItemKeydesignates a part of the input that has been successfully parsed as a certain symbol with certain parameters.See moreSeealso
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 ... Rnwhere
Lis the left-hand side of the rule, andR1 ... Rnis the right-hand side of the rule.Unlike the rules of a context-free grammar though, each of the symbols
L,R1, …,Rncarries 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
Ldoes 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 thatLis now treated as a nonterminal symbol. This enables a form of scannerless parsing.Seealso
GrammarSee moreSeealso
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 moreTerminalKeyis used to distinguish which terminal and input parameter are under consideration.Declaration
Swift
public struct TerminalKey<Param> : Hashable where Param : Hashable
Structures Reference