In Grammars§

See primary documentation in context for Creating grammars

Grammar is the superclass that classes automatically get when they are declared with the grammar keyword instead of class. Grammars should only be used to parse text; if you wish to extract complex data, you can add actions within the grammar or use an action object in conjunction with the grammar.