Navigation
Synopsis The Tree data type as produced by the parser.
Types
data Tree
     = appl(Production prod, list[Tree] args) 
     | cycle(Symbol symbol, int cycleLength) 
     | amb(set[Tree] alternatives)  
     | char(int character)
     ;
data Production 
     = prod(Symbol def, list[Symbol] symbols, set[Attr] attributes) 
     | regular(Symbol def)
     | error(Production prod, int dot)
     | skipped()
     ;
data Attr 
     = \assoc(Associativity \assoc) 
     | \bracket()
     ;
data Associativity 
     = \left() 
     | \right() 
     | \assoc() 
     | \non-assoc()
     ;
data CharRange = range(int begin, int end) ;
alias CharClass = list[CharRange] ;
data Symbol = \start(Symbol symbol) ;
data Symbol 
     = \sort(str name)   
     | \lex(str name) 
     | \layouts(str name) 
     | \keywords(str name)
     | \parameterized-sort(str name, list[Symbol] parameters)  
     | \parameterized-lex(str name, list[Symbol] parameters)  
     ;
Usage import ParseTree;
Description
  • A Tree defines the trees normally found after parsing () and additional constructors () that are used in error trees.
  • A Production () is a rule of a grammar, with a defined non-terminal, a list of terminal and non-terminal symbols and a possibly empty set of attributes.
  • An Attr (attribute, ) documents additional semantics of a production rule. Neither tags nor brackets are processed by the parser generator. Rather downstream processors are activated by these. Associativity is a parser generator feature though.
  • Associativity () defines the kinds of associativity.
  • CharRange () defines a range of characters.
  • A CharClass () consists of a list of characters ranges.
  • The start symbol () wraps any symbol to indicate that it is a start symbol of the grammar and may occur at the root of a parse tree.
  • Symbol defines non-terminals (), terminals () and regular expressions ().
  • The Conditional wrapper () adds conditions to the existence of an instance of a symbol.
  • A Condition () on a symbol gives rise to a disambiguation filter.
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.