combine the shunting yard part and comparing part