The Museum of HP Calculators

HP Forum Archive 19

[ Return to Index | Top of Index ]

Parsing Object Oriented Expressions with RPN
Message #1 Posted by Howard Owen on 5 Oct 2010, 1:39 a.m.

Incredibly geeky hyperlink.

      
Re: Parsing Object Oriented Expressions with RPN
Message #2 Posted by Bill Zimmerly on 5 Oct 2010, 3:07 a.m.,
in response to message #1 by Howard Owen

Very cool Howard, thanks for posting it. ;)

      
Re: Parsing Object Oriented Expressions with RPN
Message #3 Posted by David Hayden on 5 Oct 2010, 6:18 a.m.,
in response to message #1 by Howard Owen

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.

            
Re: Parsing Object Oriented Expressions with RPN
Message #4 Posted by Thomas Klemm on 5 Oct 2010, 12:57 p.m.,
in response to message #3 by David Hayden

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.

      
Re: Parsing Object Oriented Expressions with RPN
Message #5 Posted by Namir on 6 Oct 2010, 2:03 a.m.,
in response to message #1 by Howard Owen

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.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall