Parse raw gradient with shunting yard