Re: computation of the canonical collection of sets of LR(0) items

Scott Burson <FSet.SLB@gmail.com>
Sat, 15 Mar 2008 11:36:36 -0700 (PDT)

          From comp.compilers

Related articles
computation of the canonical collection of sets of LR(0) items carlo.salinari@gmail.com (Carlo Salinari) (2008-03-10)
Re: computation of the canonical collection of sets of LR(0) items FSet.SLB@gmail.com (Scott Burson) (2008-03-15)
| List of all articles for this month |

From: Scott Burson <FSet.SLB@gmail.com>
Newsgroups: comp.compilers
Date: Sat, 15 Mar 2008 11:36:36 -0700 (PDT)
Organization: Compilers Central
References: 08-03-047
Keywords: LR(1)
Posted-Date: 15 Mar 2008 15:09:45 EDT

On Mar 10, 4:57 pm, Carlo Salinari <carlo.salin...@gmail.com> wrote:


> Couldn't the algorithm be rewritten like this:
>
> void items(G') {
> C = CLOSURE({[S' -> .S]});
> repeat
> for ( each set of items I in C )
> for ( each symbol X in the current set that is on the
> right of a dot )
> if ( GOTO(I, X) is not already in C )
> add GOTO(I, X) to C;
> until no new sets of items are added to C on a round;
>
> }
>
> Avoiding a (possibly large) set of unfruitful iterations?


I believe you are correct. I think it's just a case where the most
elegant way to describe an algorithm isn't exactly how you would want
to implement it. I'm sure there are plenty of such cases in any
compiler text.


-- Scott


Post a followup to this message

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