Menu

#20 Pattern-match terminal | terminal

open
5
2012-08-29
2011-03-22
Tom Harwood
No

Consider the patterns Foo(Bar(void) expression) and Foo(Baz(void) expression) -- these can be naturally factored into Foo(barOrBaz expression) but then the BURM needs a reduction for barOrBaz = Bar(void) and barOrBaz = Baz(void). It would be well to introduce a terminal match that accepted alternates, so the pattern could be Foo( (Bar(void) | Baz(void) ) expression ).

This could also be done for nonterminals, at which point JBurg's grammar would be getting close to LR, but nonterminals are trickier to implement (and to program a specification for) because they have heterogeneous types.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB