Allow the grammar to specify a preference for a generator

Overridable, like start production
This commit is contained in:
John Doty 2024-06-01 05:42:40 -07:00
parent 55c4675fe5
commit e203e27407
3 changed files with 16 additions and 7 deletions

View file

@ -1,7 +1,7 @@
# This is an example grammar.
import re
from parser import Assoc, Grammar, Nothing, Terminal, rule, seq, Rule
from parser import Assoc, GenerateLALR, GenerateLR1, Grammar, Nothing, Terminal, rule, seq, Rule
ARROW = Terminal("Arrow")
AS = Terminal("As")
@ -81,6 +81,7 @@ class FineGrammar(Grammar):
#
(Assoc.NONE, [self.is_expression]),
],
generator=GenerateLALR,
)
@rule("File")