Related articles |
---|
Markers in bottom-up eval of inherited attr. willverine@hotpop.com (Will) (2001-10-27) |
Re: Markers in bottom-up eval of inherited attr. guzzev@yahoo.com (2001-11-05) |
From: | guzzev@yahoo.com (100) |
Newsgroups: | comp.compilers |
Date: | 5 Nov 2001 00:03:32 -0500 |
Organization: | http://groups.google.com/ |
References: | 01-10-139 |
Keywords: | parse, attribute |
Posted-Date: | 05 Nov 2001 00:03:32 EST |
"Will" <willverine@hotpop.com> wrote...
> I have two related questions about markers:
>
> Question 1:
> ------------
As far as marker nonterminal 'M' appears in exactly one production we
can be sure that when we have to reduce preoduction M->epsilon the
exact place of M.i attribute in the stack.
> Question 2:
> -----------
>
> After example 5.18, new dragon says "Marker terminals can also be used
> to simulate semantic rules that are not copy rules.", and this is
> given:
>
> Before:
> S -> aAC C.i := f(A.s)
>
> After:
> S -> aANC N.i := A.s; C.i := N.s
> N -> epsilon N.s := f(N.i)
>
> where N is the marker this time. Again I fail to see the usefulness
> (and again this is due to the new dragon not evening mentioning WHY
> there's a problem with the 'Before' scenario). Why can't we evaluate
> f(A.s) directly in the 'Before' scenario? We know A.s will be
> val[top-1], so just before you reduce, just compute f(val[top-1]).
>
>
Unfortunately in the val stack we can store only the syhthesised
attributes, so if we have to use some inherited attribute optained
using copy rules then we just should refer to correct synthesised
attribut used in copy rule. However, in the case "before" if we have
to use C.i atribute we can't find it anywhere in the val stack because
it is not a copy rule. Using marker production we can be sure about
the place of C.i(in fact N.s) in the stack
B/rgds
100
Return to the
comp.compilers page.
Search the
comp.compilers archives again.