Anyone got an infix to postfix (RPN) math notation converter?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Anyone got an infix to postfix (RPN) math notation converter?
I've looked around a bit and haven't found anything quite what I want.

I just want a method that will take a string in infix notation and return a
string in Reverse Polish Notation.
 
Should be pretty easy to build. All you have to do is to build a parser
that takes precedence into account...
 
Gabriel Magaña said:
Should be pretty easy to build. All you have to do is to build a parser
that takes precedence into account...

....and constants (integer, float, scientific notation), unary operators,
binary operators (left->right, right->left), parentheses, etc. This can be
a real project depending on how much is expected.

-- Alan
 
...and constants (integer, float, scientific notation), unary operators,
binary operators (left->right, right->left), parentheses, etc. This can
be a real project depending on how much is expected.

Hehe! When I was in college I pulled an all nighter building something
exactly like this... Ah the good ol' days!
 
PIEBALD said:
I don't need it to evaluate the expression, just transform it.

No less work, really, just a little different. Parsing is the same whether
evaluating or transforming. Search the web for recursive descent parsing.

-- Alan
 
Hehe! When I was in college I pulled an all nighter building something
exactly like this... Ah the good ol' days!

Indeed, I did too in VAX Pascal. I don't even have the textbook anymore.
I have found some C++ code that I'll try to convert to C#.
 
Back
Top