|Markers in bottom-up eval of inherited attr. firstname.lastname@example.org (Will) (2001-10-27)|
|Re: Markers in bottom-up eval of inherited attr. email@example.com (2001-11-05)|
|Date:||5 Nov 2001 00:03:32 -0500|
|Posted-Date:||05 Nov 2001 00:03:32 EST|
"Will" <firstname.lastname@example.org> 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
> S -> aAC C.i := f(A.s)
> 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
Return to the
Search the comp.compilers archives again.