|synthized attributes in eli firstname.lastname@example.org (Oguz Akyuz) (2002-11-26)|
|Re: synthized attributes in eli email@example.com (Tony Sloane) (2002-12-01)|
|From:||"Tony Sloane" <firstname.lastname@example.org>|
|Date:||1 Dec 2002 22:41:53 -0500|
|Organization:||Dept of Computing, Macquarie University|
|Posted-Date:||01 Dec 2002 22:41:53 EST|
On Wed, 2002-11-27 at 14:14, Oguz Akyuz wrote:
> assume I have a small grammar like:
> A: B / C .
> When I try:
> RULE: A ::= B COMPUTE
> A.Type = B.Type;
> (Assume that both A and B have Type attributes and B.Type is something
> I get an error like "miscomputation of A.Type" from eli system.
> Why does eli demand me to also add the rule(since adding this solves
> the problem):
> RULE: A ::= C COMPUTE
> A.Type = C.Type;
> I couldn't understand the point. I would be pleased if someone explains.
The reason Eli (actually LIGA, the attribute grammar tool used in Eli)
complains is because for an attribute grammar to be well-defined you
need to specify how to compute the attributes for all possible ASTs that
conform to the underlying context-free grammar.
In your case you have two grammar rules that define A. If you specify
that A has a synthesized Type attribute then you must say how to compute
it in both rules that define A (because either of these might be used in
a tree). Hence Eli insists that you add some computation for A.Type in
the A : C rule.
Feel free to contact me off the compilers list if you want more
Tony Sloane <email@example.com>
Dept of Computing, Macquarie University
Return to the
Search the comp.compilers archives again.