Shunting yard algorithm