Anyone with reverse polish notation experience?
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Mar 11, 2003
- 515 views
I'm parsing (prefix) expressions and getting reverse polish notation out. The question I have is at the point of pushing a postfix operator on a stack, clearly *all* the necessary pre-calculations will have been done. Should be a no-brainer, but I'm doing it register-based rather than stack-based. I'm adamant about prefix; eg add(3,4) instead of 3+4 Maybe later I'll get my head round infix.... (Guess I could stomach a link which makes me confident enough to do both in v0.1, rather than as I am just trying to get it working...) My question at this point is: Has anyone a difficult prefix-only expression hard to parse; rpn which worked unexpectedly, and/or any pointers which may save me some time? Eg: add(add(3,4),add(5,6)); not: (3+4)+(5+6) Equally, does anyone have an expression they feel would be hard to express in prefix rather than infix notation? Thanks, Pete