|LR(0) generation Question email@example.com (=?ISO-8859-1?Q?Andr=E9_Betz?=) (2005-10-02)|
|Re: LR(0) generation Question firstname.lastname@example.org (Cleo Saulnier) (2005-10-03)|
|Re: LR(0) generation Question email@example.com (Chris Dodd) (2005-10-03)|
|From:||Chris Dodd <firstname.lastname@example.org>|
|Date:||3 Oct 2005 00:30:02 -0400|
|Posted-Date:||03 Oct 2005 00:30:02 EDT|
André Betz <email@example.com> wrote in news:firstname.lastname@example.org:
> Hi I have a question about generating the LR(0) closure for an SLR(1)
> Parser Table. Following is a typical example:
[ much snipped so as to include just the relevant context ]
> (4,2) F->'(',.E,')';
> (0,1) E->.E,'+',T;
> (4,3) F->'(',E,.')';
> ? E->E,.'+',T;
> So my question is:
> Wy is in Closure(8) this rule E->E,.'+',T; added.
Its there from rule 4. When you evaluate a goto, you need to make
a new state from ALL the rules in the old state the have the symbol
in question next. Since state 4 has two rules with '.E', both of
them are added to the new state with the point advanced past the 'E'.
Return to the
Search the comp.compilers archives again.