grammar.py: some clean-ups