Parsing Object Oriented Expressions with RPN



Post: #6

Incredibly geeky hyperlink.


Post: #7

Very cool Howard, thanks for posting it. ;)

Post: #8

For what it's worth, this is basically how an algebraic calculator evaluates an expression that you type. So in a way, even TI's are RPN at heart :).

HP calculators do the same thing when they parse a symbolic expression because symbolics are stored in postfix notation.


Post: #9

Quote:
symbolics are stored in postfix notation.

That's why you can't enter something like '(A+B)'. It is stored as 'A B +' and displayed as 'A+B'.

BTW: There's a programm ->RPN in the directory 'EXAMPLE/PRGS' you get when executing the command TEACH. It transforms an algebraic expression to its equivalent RPN-representation.

Thomas

Edited: 5 Oct 2010, 12:59 p.m.

Post: #10

Several years ago I wrote an expression parser that converts an algebraic expression (with variables and functions) into an array of RPN tokens. This approach allows the re-evaluation of the expression multiple times without having to re-parse each time. It was a fun project in VB .Net.

The program's GUI would list the parsed RPN expression.

Namir

Edited: 6 Oct 2010, 2:04 a.m.


Forum Jump: