grammar decomposition to simplify visitor