Infix to PostFix
hi,
I have an infix format as shown below, i need to know how does this logical infix expression can be converted in to postfix expression.
How do v specify the IF THEN ELSE of the expression in the postfix expression.
IF:VarX :> :123 :THEN :VarY := :234 :+ :VarSAM :EIF
Thanks in advance..
[331 byte] By [
jnima] at [2007-10-1 0:32:46]

the question as you have asked it has no answer. It is a bit like saying, "I want to travel to a foreign land, How do you say 'Hello'"
The problem is that you have not specified any language.
In-fix and post-fix simply refer to two different ways of writing out trees (and the use of the term 'infix' strongly implies binary trees at that). In post fix you ouput the value of a parent only after you have output the value of the children of that parent. In in fix you output the parent inbetween its two children (hence the implication of binary trees)
In the world of mathematical expressions, like you learn in algebra and calculus, there is a well defined and commonly understood structure (that also just happens to be binary for the four main operation +,-,*,/) So it is easy to talk about taking the expression:
6 + 3*(7 - 5)
and talk about the postfix form:
6 3 7 5 - * +
However when you are talking about parsing a computer expression, you are now talking about general trees and there are numerous different ways that you could structure those trees.
For example you could think of an IF as a 3 way branching node like this
IF(boolean, code1, code2)
or if you want to be binary about it you introduce a new branch node
IF(boolean, CodePair( code1, code2))
But nothing prevents you from doing any other wierd thing like perhaps
ELSEIF( code2, SimpleIF(boolean, code1))
Needless to say all of these representation are equally valid and all have completely different post fix representations.
Since you have not defined any underlying tree structure for the code in your example it is not possible to give an answer.
If your little infix example was in fact derived from a grammer, then you must go back and look at the tree structure that was implied by your grammer and then you could possibly talk meaningfully about a post fix representation of the parse.
Hope that helps