|Parse mathematic expression to tree then RPN firstname.lastname@example.org (Yoong Hor Meng) (2003-02-12)|
|From:||Yoong Hor Meng <email@example.com>|
|Date:||12 Feb 2003 13:40:48 -0500|
|Organization:||Subscriber of Pacific Internet|
|Posted-Date:||12 Feb 2003 13:40:47 EST|
I am hand writing a library to parse mathematic expression
Z = sin(A + B) + 33 * tan(C) + sqrt(D)
Converting this expression to tree would take a lots of backtracking
and consideration. Once it is stored in tree, using deep-first
travesal, RPN expression can be created very easily.
Could someone provides me information or resources to convert the
expression to tree format?
Thank you very much
[Parsing an expression is the first example in just about every
compiler text. You can use a simple operator precedence parser
to parse it with no backtracking and to create RPN in one pass. -John]
Return to the
Search the comp.compilers archives again.