Calculator parser refactor