[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: consistent states and error transitions
From: |
Joel E. Denny |
Subject: |
Re: consistent states and error transitions |
Date: |
Sun, 27 May 2007 20:13:12 -0400 (EDT) |
On Sun, 27 May 2007, Paul Eggert wrote:
> "Joel E. Denny" <address@hidden> writes:
>
> > I'd like to commit the following. I'd appreciate a second pair of eyes to
> > be sure my assumptions are correct.
>
> The change looks OK to me, not that I've thought it through as
> carefully as you have.
Thanks for reviewing it.
> However, shouldn't there also be a change to
> the comment for 'consistent'? Currently it says:
>
> /* Nonzero if no lookahead is needed to decide what to do in state S. */
> char consistent;
>
> Doesn't one in general need lookahead to decide what to do in an error
> state?
For states that shift the error token, I believe it makes sense the way
it's worded. If such a state has no reduce actions, then lookahead sets
are not possible, and the state is considered consistent. If such a state
has reduce actions, then the state needs lookahead sets and is considered
inconsistent. Does that sound reasonable?
The only flaw I see with the wording is that it claims that inconsistent
states always need lookaheads. Consider a state that doesn't have a shift
on the error token, that does have at least one other shift, and that has
only one reduce action. That reduce action becomes the default rule, so
it doesn't really need lookaheads, but the state is still considered
inconsistent because it has both reduce and shift actions.
How does the following sound?
/* If non-zero, then no lookahead sets on reduce actions are needed to
decide what to do in state S. */
char consistent;
Or did I miss the point?