make shunting-yard use generators, extract stack_has_higher_operator logic