Attach priority on rules.
Grammars must have at least one rule.
Factor out grammar generator as own def.