Re: LR(0) generation Question

Chris Dodd <cdodd@acm.org>
3 Oct 2005 00:30:02 -0400

          From comp.compilers

Related articles
LR(0) generation Question mail@andrebetz.de (=?ISO-8859-1?Q?Andr=E9_Betz?=) (2005-10-02)
Re: LR(0) generation Question cleos@nb.sympatico-dot-ca.remove (Cleo Saulnier) (2005-10-03)
Re: LR(0) generation Question cdodd@acm.org (Chris Dodd) (2005-10-03)
| List of all articles for this month |
From: Chris Dodd <cdodd@acm.org>
Newsgroups: comp.compilers
Date: 3 Oct 2005 00:30:02 -0400
Organization: Compilers Central
References: 05-10-015
Keywords: parse
Posted-Date: 03 Oct 2005 00:30:02 EDT

André Betz <mail@andrebetz.de> wrote in news:05-10-015@comp.compilers:
> 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:
> (4,2) F->'(',.E,')';
> (0,1) E->.E,'+',T;
:
> 8:
> (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'.


Chris Dodd
cdodd@acm.org


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.