refactoring the arithmetics parser