help-bison
[Top][All Lists]
Advanced

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

Re: resolving shift/reduce in ActionScript3


From: Matthias Kramm
Subject: Re: resolving shift/reduce in ActionScript3
Date: Wed, 26 Nov 2008 16:42:59 +0100
User-agent: Mutt/1.5.6i

On Wed, Nov 26, 2008 at 03:25:42PM +0100, Hans Aberg <address@hidden> wrote:
> >state 1
> >    4 EXPRESSION: T_IDENTIFIER . '(' EXPRESSION ')'
> >    5           | T_IDENTIFIER .  [$end, T_IDENTIFIER, ';', '(',  
> >')', "++", "--", '+', '-', '/']
> >    '('  shift, and go to state 5
> >    '('       [reduce using rule 5 (EXPRESSION)]
> >    $default   reduce using rule 5 (EXPRESSION)
> >
> >Is there some way to tell bison to prefer shifting to reducing in this
> >case?
> 
> If one should use Bison token precedence, then T_IDENTIFIER needs to  
> be expanded in the grammar, so that there is a token immediately  
> before the parsing "." in the shift-reduce conflict above.

Thanks for the tip- I'll try that.

> But if your identifiers have been defined and pu on a look-up table  
> which the lexer can read, them change the rule above to
>   EXPRESSION:
>     FUNCTION '(' EXPRESSION ')'
> where the lexer returns the token FUNCTION.

Afraid look-up is not possible, as ActionScript allows forward 
references. (And I'm not sure whether switching to two-pass 
parsing would be a good idea. Is two-pass parsing with bison a
"typical" use case?)

Greetings

Matthias






reply via email to

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