On Sun, May 3, 2009 at 11:06, Robert Kern <[email protected]> wrote: > On Sun, May 3, 2009 at 10:59, Ondrej Certik <[email protected]> wrote: > >> Google app engine supports eval(), so we may just write a simple >> preparser based on the "re" module (also available on the app engine), >> that converts things like 1/2 to Integer(1)/Integer(2) and "x" to >> Symbol("x") and we should be fine. I don't know if eval() can handle >> large expressions (to fix #976), that would have to be tried. Usually >> a large expression is one big Add instance, so one solution that just >> occured to me is to split it into several smaller Add instances, >> evaluate each using eval() and add them together. > > It's feasible to write and maintain a pyparsing parser for Python's > expression subgrammar. This also opens up the possibility for easily > extending the grammar to add other operators and such.
Another alternative is Fredrik Lundh's hand-built parser here: http://effbot.org/zone/simple-top-down-parsing.htm It has the advantage of already being written. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---
