help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shift reduce errors due to embedded actions


From: David Durham
Subject: Re: Shift reduce errors due to embedded actions
Date: Tue, 16 Oct 2001 09:30:53 -0500

On Tue, 2001-10-16 at 03:37, Hans Aberg wrote:
> At 09:52 -0500 2001/10/15, David Durham wrote:
> >I short (and a bit over simplified), inserting the extra mid-rule
> >actions causes bison to have to execute that action before going too
> >much further in the input (1 token or 1 reduction, not sure)...
> 
> One should be careful to note that Bison may or may not may a token
> lookahead as needed. This means that if the lexer executes an action in the
> token that follows, Bison may or may not execute that before the mid-rule
> action.
> 

This is true, I wouldn't attempt to tie the lexer and the parser so
tightly... At least leave 1 token between what the lexer might do and
when the parser needs that to have been done.  Say, a ';' between a
typedef and a variable decl, because the lexer may return something
different an ident is a typename or just an ident

> > So if
> >some rule cannot be distinguished from another rule up to that point of
> >the mid-rule action, it can't say, do you action, then realize, 'oh I
> >didn't need to do that...' then undo the results of that action...
> 
> Bison never backtracks, so I think that reasoning in terms of "undoing
> actions" may be confusing as to how Bison really works: Nothing is really
> ever undone.
> 
>   Hans Aberg
> 

Yes, I was just hypothetically saying: IF bison were to go ahead (which
it wouldn't), it wouldn't even be able to go back and undo the damage
that the mid-rule action (that didn't need to execute afterall) had
done..

 -- Davy





reply via email to

[Prev in Thread] Current Thread [Next in Thread]