grammar refinements and initial visitor implementation