in reply to Parse::RecDescent without parentheses


WARNING: I might be talking out of my butt here.

I havn't used Parse::RecDescent yet, but I was weened on yacc.
The first one (4+8) works because you have and add_calculation which is a calculation that is allowed in your start rule.
The second one (4+8+5) doesn't because it can't match the add calculation. I think it's because it matches 4+8 as the statement leaving +5 left over, causing your startrule to fail.

The heart of the problem is that a num op num expression isn't a calculation unless it is surrounded by ().

I'm, however not exactly sure how to fix it, and I'm under the gun on my own project, so hopefully, an expert can reply here and fix the grammar. UPDATE: Maverick beat me to the punch with a better answer. See his response

-pete
Entropy is not what is used to be.
  • Comment on Re: Parse::RecDescent without parentheses