LIDO - Reference Manual
A rule specification specifies a production of the tree grammar, and may associate some computations with the rule context. They are executed in every context which represents that rule in a particular tree.
RuleSpec ::= 'RULE' [RuleName] ':' Production Computations 'END'
RULE p: Stmt ::= 'while' Expr 'do' Stmt COMPUTE Expr.postType = boolType END;
There may be several rule specifications that refer to the same rule. In that case the associated computations are accumulated.
In general the
Two unnamed rule specifications refer to the same rule if their productions are identical.
A named rule specification and an unnamed one refer to the same rule if their productions are identical. In that case there must not be another rule specification with the same production but a different name.
Two named rule specifications with the same
A production as part of a rule specification describes the structure of the rule context. Computations associated with the rule may use or define attributes of nonterminal symbols that occur in the production. The set of all productions in a LIDO specification defines the tree grammar.
Production ::= SymbName '::=' Symbols | SymbName 'LISTOF' Elements Symbols ::= Symbols Symbols | | SymbName | Literal Elements ::= Elements '|' Elements | | SymbName TermSpec ::= 'TERM' SymbNames ':' TypeName
Stmt ::= 'while' Expr 'do' Stmt DefIdent ::= Identifier Declarations LISTOF ProcDecl | VarDecl TERM Identifier: int;
We say the rule context is a lower context for the left-hand side nonterminal, and an upper context for any right-hand side nonterminal.
Literal terminals do not contribute to the trees specified by the tree grammar. They only relate tree productions to concrete productions describing the input text, and distinguish otherwise equal productions.
Named terminal symbols do not contribute to the trees specified by the tree grammar. They are related to named terminal symbols of corresponding concrete productions describing the input text. A value derived from such an input token may be used in computations which are associated with the rule of the production or with the symbol on the left-hand side of the production. (If the tree context is constructed by a computation, rather than by parsing the input text, then that value is supplied as an argument to the call of the construction function (see Tree Construction Functions).)
The type of the value provided by a named terminal symbol is specified
There are two forms of productions: plain productions and
A plain production defines tree contexts with a node for the left-hand side nonterminal having a sequence of subtrees, one for each nonterminal on the right-hand side.
Computations may refer to any attribute of any nonterminal in the production. If one nonterminal occurs more than once in the production references to the occurrences in computations are distinguished by indices (starting from 1).
Computations associated with the rule of a
Named terminals may not be
A literal terminal may not be the empty string.