Help improve program for parsing simple rules
Paul McGuire
ptmcg at austin.rr.com
Fri Apr 17 11:26:30 EDT 2009
On Apr 16, 10:57 am, prueba... at 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.
-- Paul
More information about the Python-list
mailing list