Search code examples
scalapostfix-notationinfix-notation

Does Scala provide an easy way to convert Infix expressions to postfix ones?


I a beginner in Scala and I am writing a program in Scala to convert infix arithmetic expression to the postfix one meanwhile wondering whether Scala provided an easier way to handle these kind of conversions. Can anyone guide me if there is any easier way for it?


Solution

  • A way to do it is to use Dijkstra's Shunting Yard algorithm. Here is one implementation in Scala.