|Basic parser grammar question firstname.lastname@example.org (Denis Washington) (2007-04-20)|
|Basic parser grammar question email@example.com (O JuciE) (2007-04-26)|
|From:||Denis Washington <firstname.lastname@example.org>|
|Date:||20 Apr 2007 10:24:12 -0400|
|Posted-Date:||20 Apr 2007 10:24:12 EDT|
I have a small problem with a PLY  grammer, more particularly with
the part that parses arithmetic expressions, which looks like in the
"additive-expression : multiplicative-expression"
p = p
"additive-expression : additive-expression additive-operator
p = operator_expression_to_call(p, p, [p], filename,
"additive-operator : PLUS"
p = "__add__"
"additive-operator : MINUS"
p = "__sub__"
This piece of grammar works fine if I have simple additive expressions
like "a + b", but fails to function if having longer arrays of additive
expressions, e.g. "a + b + c". Why is that? Have I missed something? I
hope you can help me.
Return to the
Search the comp.compilers archives again.