Help improve program for parsing simple rules

pruebauno at pruebauno at
Fri Apr 17 14:52:40 CEST 2009

On Apr 16, 9:29 pm, John Machin <sjmac... at> wrote:
> On Apr 17, 1:57 am, prueba... at wrote:
> > COMP_REPLACERS={'LT':'<', 'GT':'>', 'LE':'<=', 'GE':'>=', '=':'==',
> > '=>':'=>', '=<':'=<'}
> What do the '=>' and '=<' represent? Why are you replacing each by
> itself?

because of this:

I didn't want to create a separate variable. Those are dubious anyway,
I haven't seen one in all of our current rules and it generates a
syntax error in Python so I took them out:

COMP_REPLACERS={'LT':'<', 'GT':'>', 'LE':'<=', 'GE':'>=', '=':'=='}

And before somebody else points it out. This line:

(TOK.NUMBER,str(vars_.get(x[1],x[1]))) if x[0]==TOK.NAME

should really be:

(TOK.NUMBER,str(vars_[x[1]])) if (x[0]==TOK.NAME and x[1] in vars_)

More information about the Python-list mailing list