pretty print for all types of grammars