expression convert from infix to prefix

Can someone post pseudocode to convert expression from infix to prefix as mentioned below: plz do ASAP thanks..
Your expression evaluator should contain following core functionality.

1. Input as infix expression.
2. Operands should be single digit.
3. operators +. -, x , /, ^, negation. Etc.
4. parenthesis should also be supported. ( it simple. Starting parenthesis: push in operand stack. Ending parenthesis: pop all operators until a starting parenthesis is found. Ending and starting parenthesis are not added to output prefix expression. Also, if a low priority operator comes, it will pop all higher/equal priority operators until a starting parenthesis)
5. print output prefix expression on screen.
6. Use same expression or a newly input expression from user.
7. Calculate solution of prefix expression.
8. If any error is found in calculation, indicate.

1. Input operands may be multidigit and decimal numbers.
2. Input operands may be variable.
3. Operands may be more complex. Like exp(x), sin(x), a+b(c+d), -a%b, etc.
See http://rosettacode.org/wiki/Parsing/Shunting-yard_algorithm

Also, from http://en.wikipedia.org/wiki/Shunting-yard_algorithm :

The shunting yard algorithm can also be applied to produce prefix notation (also known as polish notation). To do this one would simply start from the end of a string of tokens to be parsed and work backwards, reverse the output queue (therefore making the output queue an output stack), and flip the left and right parenthesis behavior (remembering that the now-left parenthesis behavior should pop until it finds a now-right parenthesis).
i want pseudo code algorithmi found earlier thanks
Topic archived. No new replies allowed.