Search code examples
algorithmnotation

Is there an existing algorithm for this notation translation/conversion?


A system has a notation that would require writing an expression like (A+B)*C as #MUL(#ADD(A,B),C). Is there already an algorithm to do this kind of notation conversion so users can enter in a more conventional way? In other words an algorithm to convert from infix -> my notation. First issue is I don't know an exact name for my notation... it's similar to reverse-polish but not quite. Every operator is encoded as a function taking arguments.


Solution

  • Shunting-yard algorithm can be used to parse infix notation.