Re: computation of the canonical collection of sets of LR(0) items
by Scott Burson <FSet.SLB@[EMAIL PROTECTED]
>
Mar 15, 2008 at 11:36 AM
On Mar 10, 4:57 pm, Carlo Salinari <carlo.salin...@[EMAIL PROTECTED]
> 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