http://paste.pocoo.org/show/152562/ is the debug output.  This leads
me to believe the issue is somehow related to my rule being:
        expression : expression STAR STAR expression %prec POWER

instead of expressing STAR STAR as a single token.  If that's the
issue I guess I just need to update my lexer.

Alex

On Mon, Nov 23, 2009 at 9:07 PM, David Beazley <[email protected]> wrote:
> Hmmm.  It's hard to say for certain.  However, I just tested the calculator 
> example with an added power operator (right precedence) and it worked 
> correctly.   There are some debugging modes for yacc.parse() that might be 
> worth investigating here.
>
>        http://www.dabeaz.com/ply/ply.html#ply_nn46
>
> Cheers,
> Dave
>
>
> On Nov 23, 2009, at 7:26 PM, Alex_Gaynor wrote:
>
>> I've got a grammar with precedence:
>>
>>    precedence = (
>>        ("nonassoc", "COMPARISON"),
>>        ("left", "AMPER", "VBAR", "CIRCUMFLEX"),
>>        ("left", "PLUS", "MINUS"),
>>        ("left", "STAR", "SLASH", "PERCENT"),
>>        ("right", "UNARY"),
>>        ("right", "POWER"),
>>    )
>>
>> Which I believe is correct.  However given: a ** b ** c; it parses it
>> as:
>> [('BinOpNode', ('BinOpNode', ('NameNode', 'a'), ('NameNode', 'b'),
>> '**'), ('NameNode', 'c'), '**')]
>>
>> Whereas I would expect:
>> [('BinOpNode', ('NameNode', 'a'), ('BinOpNode', ('NameNode', 'b'),
>> ('NameNode', 'c'), '**'), '**')]
>>
>> Hopefully that syntax is clear.  Any suggestions as to why I'm getting
>> an incorrect parse.
>>
>> Alex
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups 
>> "ply-hack" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/ply-hack?hl=en.
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "ply-hack" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/ply-hack?hl=en.
>
>
>



-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

--

You received this message because you are subscribed to the Google Groups 
"ply-hack" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/ply-hack?hl=en.


Reply via email to