On Apr 18, 1:26 am, Paul McGuire <pt...@austin.rr.com> wrote: > On Apr 16, 10:57 am, prueba...@latinmail.com wrote: > > > Another interesting task for those that are looking for some > > interesting problem: > > I inherited some rule system that checks for programmers program > > outputs that to be ported: given some simple rules and the values it > > has to determine if the program is still working correctly and give > > the details of what the values are. If you have a better idea of how > > to do this kind of parsing please chime in. I am using tokenize but > > that might be more complex than it needs to be. This is what I have > > come up so far: > > I've been meaning to expand on pyparsing's simpleArith.py example for > a while, to include the evaluation of the parsed tokens. Here is the > online version,http://pyparsing.wikispaces.com/file/view/eval_arith.py, > it will be included in version 1.5.2 (coming shortly). I took the > liberty of including your rule set as a list of embedded test cases.
Hi Paul, I don't see how it can handle the chained relop in the last two testcases e. g. '0.00 LE A LE 4.00' -- unless relops are chained by default in your parser. Cheers, John -- http://mail.python.org/mailman/listinfo/python-list