The context-free level has explicit knowledge about the grammar for the language. For each nonterminal A of the grammar, a corresponding pattern is automatically generated, depending on the defining rule for A. For each rule type described in section 2, the list below describes the corresponding generated patterns.
where P is the pattern corresponding to the super-category of A. The pattern P is thus the super-pattern for A.
A: P(# #)
where P is the super-category of A. There is an attribute corresponding to each nonterminal on the right side of the rule. The suffix of the get- and put- attributes (Ti) is the same as the corresponding tag-name.
A: P (# getT1: getson1(# #) putT1: putson1(# #) getT2: getson2(# #) putT2: putson2(# #) ... getTn: getsonn(# #) putTn: putsonn(# #) #)
where B is the name of the nonterminal on the right side of the rule. The super-pattern is List as the super-category of A is List.
A: List(# sonCat::< B #)
Constructor rules are thus mapped into a composition hierarchy and alternation rules into a classification hierarchy.
By using the context-free level it is not possible for a programmer to construct an AST that violates the context-free syntax.
The Metaprogramming System - Reference Manual | © 1991-2002 Mjølner Informatics |
[Modified: Thursday October 19th 2000 at 12:04]
|