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

    ConstructResult
    See more

    Declaration

    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, and R1 ... 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 property eval (in tandem with the property initialEnv) 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 that L is now treated as a nonterminal symbol. This enables a form of scannerless parsing.

    Seealso

    Grammar

    Seealso

    EvalFunc
    See more

    Declaration

    Swift

    public struct Rule<Param>
  • The result of parsing a terminal (either via a lexer or via rules).

    See more

    Declaration

    Swift

    public struct Token<Param, Result> : Hashable where Param : Hashable
  • A TerminalKey is used to distinguish which terminal and input parameter are under consideration.

    See more

    Declaration

    Swift

    public struct TerminalKey<Param> : Hashable where Param : Hashable