Am 11.03.2012 17:58, schrieb Bharath M R:
Thanks for the reply. The parser is for building the web interface similar
to
Wolfram Alpha for SymPy.  Basically I want to parse things like
integrate x**2 dx
roots x**2==1

Won't the operator precedence parsing be sufficient for this?

These two are easy to parse with operator precedence.

The "interesting" things happen with unary minus and bra-ket notation.

> If it is not, can
you help me with some reading material on some parsing technique which can
acomplish this.

There are more general parsing techniques. The problem is that each technique places constraints on the grammars, and it quickly becomes specialist work to write a grammar that (a) expresses what you want and (b) obeys the restrictions of the parsing technique.

Among parsing techniques, operator precedence places the tightest restrictions, but it is also the most complicated one that can be mastered in a weekend (for grammar writers) or in a week (for implementors).

For a quick rundown, take a look at
http://epaperpress.com/oper/index.html .

A Pythonic operator-precedence parser seems to be at
http://effbot.org/zone/simple-top-down-parsing.htm .
"Seems to be" because I didn't thoroughly read it. What I liked about that article is that it explains how to best do it in Python.

--
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.

Reply via email to