Solves arithmetic expressions in two passes.