Is there a grammar for the sympify-function? 2011/11/6 Ondřej Čertík <[email protected]>: > On Sat, Nov 5, 2011 at 3:43 PM, Ricardo Martins de Abreu Silva > <[email protected]> wrote: >> ok, but how I will recognize that a sympy expression is valid? >> I would like a grammar for mathematical expression of functions written in >> sympy. >> I know that if this expression is simple, a parser based on the grammar of >> standard python will also recognize it, >> because sympy extend the grammar of python. > > There is a misunderstanding. SymPy does *not* extend the grammar of > Python. That is one of the sympy goals actually, to be just a Python > library and not extend the Python language. > >> But it is not true, if my expression uses specific terms in sympy, such that >> an integral for example. > > Integral is just: > > Integral(x**2, (x, 0, 1)) > > and that is a valid Python syntax. > >> So, how i can isolate a grammar just for mathematical expression in sympy, >> and consequently in python (because the grammar of sympy extends the grammar >> of python in relation to mathematical expressions). > > SymPy doesn't extend the Python grammar. > > Maybe you are confused by the fact, that the "Python grammar" is very > general, and allows things like the above. Maybe you are looking for > some subset of Python. But as Joachim said, it's most probably not > worthy. > > Ondrej > > -- > 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. > >
-- 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.
