Elektrine lite

← Feed

@monoidmusician@tech.lgbt

Post #3178133

2026-06-07 01:36 UTC

is anyone aware of research on generating LR or LL parse tables that exploits sharing in the grammar? like, the conventional approach is to expand the grammar so that it is a sum of products: each nonterminal has multiple flat rules that it can match, with no choice in those rules (the most classic of BNFs, if you will) but grammars may be constructed in a tree shape, especially with applicative combinators, where sequencing and choice are interleaved: (p <|> q) <*> (x <|> y) -- expands to (p <*> x) <|> (p <*> y) <|> (q <*> x) <|> (q <*> y) expanding this produces lots of rules and surely some duplicate work in the table generation, but I haven't seen anyone talk about this before (one way to tame the duplication is by introducing nonterminals just to group items, but this runs the risk of introducing ambiguity in an LR(1) grammar, and, uh, I don't think it actually saves the generator much if any work)

Replies (0)

No replies.