implement a more general grammar viewer.