defineGrammar:< M=unknown, GextendsGrammarEntries<G,M>=Record<string,GrammarEntry<string,M>>, >( grammar:G, )=>Grammar<keyofG&string,M> = id
Purely for type checking, at runtime this is literally the identity function.
Defines a grammar, inferring the rule names from the definition's own keys,
so that rule references and parameter references can be checked at the
definition site without having to write an explicit Grammar<...> annotation
with all the rule names.
A metadata type for the entries' extra fields can be given explicitly as the
first type argument; it defaults to unknown, which allows no extra fields.
Purely for type checking, at runtime this is literally the identity function.
Defines a grammar, inferring the rule names from the definition's own keys, so that rule references and parameter references can be checked at the definition site without having to write an explicit
Grammar<...>annotation with all the rule names.A metadata type for the entries' extra fields can be given explicitly as the first type argument; it defaults to
unknown, which allows no extra fields.