The Dijkstra Shunting-yard algorithm is a very general, linear time, stack-based algorithm for parsing mathematical expressions.
The Dijkstra Shunting-yard algorithm is a very general, linear time, stack-based algorithm for parsing mathematical expressions specified in infix notation. It can be used to produce output in Reverse Polish notation (RPN) or as an abstract syntax tree (AST). It was invented by the Dutch computer science Edsger Dijkstra, and published in 1960. He named it the "shunting yard" algorithm because its operation resembles that of a railroad shunting yard.
It is not used in most production compilers, as they already have more general parsing systems that include arithmetic expressions as a special case. It is very widely used as a teaching exercise, and it can be used in compilers for special languages where the programmer can add operators or redefine operator precedence, which are easily made variable in the algorithm, unlike the parsers generally used in production compilers.