Quote:
Originally Posted by lxmirmsh
The easiest and smallest code available to convert infix expression to postfix expression.
|
Quote:
Originally Posted by lxmirmsh
I have a program that converts an infix expression to a parse tree. wanted to see if it can convert a postfix expression as well, so figured, maybe if i added a small fragment to convert infix to postfix in the code,it'll all work out.
|
Did you mean "convert to" rather than "convert"? In that context, "convert" would mean "convert from", which is opposite your original request.
Almost all the code needed to convert from infix to parse tree is the same as almost all the code needed to convert from infix to postfix.
If you already have code to convert infix to parse tree, it should be trivial to add code to make it convert to postfix as well or optionally instead.