General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
New Features of Eli Version 4.9Allow symbols to be ignored in rule mappingsA rule map can arbitrarily rewrite a concrete rule for the purpose of matching it to an abstract rule (see Rewriting a concrete rule of Syntactic Analysis Manual). The concrete rule to be rewritten is specified exactly as it appears in the concrete syntax, and is followed by a description of the right-hand side of the abstract rule enclosed in angle brackets. Any literal symbols in the abstract rule are represented in the description by themselves. Literal symbols appearing in the abstract rule need not have counterparts in the concrete rule, and literal symbols in the concrete rule need not appear in the abstract rule. Nonliteral symbols (both nonterminals and nonliteral terminals) in the right-hand side of the abstract rule must have counterparts in the right-hand side of the concrete rule. Each nonliteral symbol in the right-hand side of the abstract rule is represented by a `$' followed by the index of its counterpart in the right-hand side of the concrete rule. There is no requirement that all nonliteral symbols from the concrete rule appear in the abstract rule, and no requirement on the order of appearance, but duplicates are not allowed. Here is an example of a concrete rule:
Exp: Lambda Idn '.' Exp .This rule has three nonliteral symbols: Lambda , Idn , and
Exp .
Lambda and Idn are terminals; Exp is a nonterminal.
Suppose that our abstract syntax has the following rules:
RULE: IdDef ::= Idn END; RULE: Exp ::= IdDef 'is bound in' Exp END;The first abstract rule tells us that an Idn may be interpreted as
an IdDef in certain contexts (such as that represented by the second
abstract rule).
We can map the concrete rule given above into the second abstract rule,
since the second abstract rule expresses the semantics of the concrete rule:
MAPRULE Exp: Lambda Idn '.' Exp < $2 'is bound in' $3 > .Here the concrete rule is given, and the right-hand side of the abstract rule is described in the angle brackets. The nonliteral terminal symbol Lambda is dropped (positional
parameter $1 does not appear in the angle brackets), and the literal
terminal symbol '.' is replaced by 'is bound in' .
|