Luke Palmer wrote:
> That left recursion won't do.  I can't remember my transformation rules
> well enough to know how to put that in a form suitable for a recursive
> descent parser.  To be honest, I've never seen an RPN calculator modeled
> with a grammar.

Well, the main advantage of an RPM syntax is to avoid the need for a
grammar. The parsing stack and the execution stack are the same.

> To be sure, a prefix calculator should be the easiest:
> 
>         rule exp :w { <@operator> <exp> <exp> | <NUM> }

Indeed.
With infix operators you need precedences.

Reply via email to