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. But it is not true, if my expression uses specific terms in sympy, such that an integral for example. 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).
thanks --rmas On Sat, Nov 5, 2011 at 8:25 PM, Aaron Meurer <[email protected]> wrote: > SymPy is written and executed in Python, so any valid SymPy expression > must be a valid Python expression. Perhaps you could give an example > of what you think doesn't follow this. > > Aaron Meurer > > On Sat, Nov 5, 2011 at 3:54 PM, Ricardo Martins > <[email protected]> wrote: > > Hi, > > > > I am not sure if sympy grammar is really a subset of python grammar, > > because in relation to mathematical expressions there are many tokens in > > sympy not include in python grammar. > > > > I saw the Python source and the sympy terms are not included in its > grammar. > > Obviously, there are many structure in python grammar that can be used in > > sympy grammar. > > But, I am only interesting in expression for mathematical functions in > sympy > > language. > > > > All best > > --rmas > > > > > > On Sat, Nov 5, 2011 at 4:54 PM, Aaron Meurer <[email protected]> wrote: > >> > >> SymPy justs uses Python's syntax, so the EBNF file for Python will > >> give you the grammar for SymPy (it will also give you the grammar for > >> the whole language, but you can probably reduce it to just expressions > >> if you want). > >> > >> You can get this from the Python source code > >> (http://www.python.org/getit/source/). It's in the Grammar directory. > >> > >> Aaron Meurer > >> > >> On Sat, Nov 5, 2011 at 7:51 AM, Ricardo Martins > >> <[email protected]> wrote: > >> > Dear colleagues, > >> > > >> > I would like to know if someone have the grammar of sympy for > >> > constructing > >> > mathematical expressions. > >> > I am preparing a grammatical evolution program to generated functions > >> > based > >> > on sympy expression. > >> > Actually, I need this grammar in BNF or EBNF format, but if you have > it > >> > in > >> > other format, no problem. > >> > > >> > Thank you so much > >> > Best Regards > >> > Ricardo > >> > > >> > -- > >> > 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. > >> > > > > -- > > 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. > > -- 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.
