A brief description of the SGLR parse table format. The parse tables are represented as Tools.ATerms.

parse-table(<term>,<term>,<term>,states([<list>]),priorities(<term>))
  • The first <term> is a version number, currently 4.
  • The second <term> is the number of the initial state, normally 0.
  • The third <term> is a list of labels of the form label(<term>,<int>), where <term> represents a production rule and <int> the label number. The production rule is represented as an ATerm and has, e.g., the form: prod([sort("<START>"),char-class([256])],sort("<Start>"),no-attrs)
  • The states have the form: state-rec(<int>,[<list>],[<list>]) where <int> represents the state number, the first list the list of gotos, and the second list the list of actions.
    • A goto item looks like goto([<list>],<int>), this list is a list of single characters, character ranges, and/or label numbers. The <int> is the state number to which the parser has to jump.
    • A action item looks like action([<list>],[<list>]), where the first list is a list of single characters and/or character ranges. The second list are the actions that have to be performed:
      • reduce(<int>,<int>,<int>): first <int> represents the number of members in of the production rule with label given as second <int>, and the last <int> represent that "status" of a production rule, prefer, avoid, reject, or normal.
      • reduce(<int>,<int>,<int>,<term>): the <term> represents a lookahead set greater than one. Lookaheads of more than one character are performed dynamically.
      • shift(<int>): the <int> represent the new state after shifting the current character.
      • accept
  • The priorities is a list of relations between 2 production rules:
    • left-prio(<int>,<int>)
    • right-prio(<int>,<int>)
    • non-assoc-prio(<int>,<int>)
    • gtr-prio(<int>,<int>) where the <int>s are the labels of the production rules involved. left, right, and non-assoc are associativity attributes used within the Tools.SDF definition. gtr is the priority relation.

Revision: r1.6 - 09 Feb 2004 - 13:17 - MartinBravenboer
SdfBackup > SDFII? > SglrParseTableFormat
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback