Grammar
class Grammar(val lexemes: List<Lexeme<*>>, val rules: Map<String, Rule<*>>, val startRule: Rule<*>?)
Represents a complete Context-Free Grammar definition with lexing and parsing capabilities.
A Grammar encapsulates both the lexical structure (via lexemes) and syntactic structure (via rules) of a formal language. It provides methods to transform raw character input into tokens (tokenize) and to parse token streams into Abstract Syntax Trees (parse).
Grammars are typically constructed using the DSL provided by Grammar.Builder through the companion object's invoke operators.