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

[lojban] Re: Computer grammar question: non-left recursive RPN?



rp-expression = rp-operand rp-operand operator
rp-operand = operand / rp-expression

here is the version without left-recursion

rp-expression = rep-operand rp-operand operator
rp-operand    = rp-operand' rp-operand
rp-operand'   = () | rp-operand operator

I think this version is correct, but i'm too busy to check it now.

Regards,
  jo
--
#include <stdio.h> /**** <wbyncnpur@serr.se> ***/
#define r(o,t)  ((c|040)>=o&&(c|040)<=o+014)?c+t:
main(void){int c;while((c=getc(stdin))!=EOF){/**/
putchar(r('a',015)(r('n',-015)c));}}/** ebg13 **/