Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
parserCatName :: Cat -> Doc () Source #
generatePatterns :: Bool -> RHS -> (String, [String]) Source #
Generate patterns and a set of metavariables (de Bruijn indices) indicating where in the pattern the non-terminals are locate.
>>>
generatePatterns False [ NTerminal (Cat' (BaseCat 'E':|"xp")), Terminal (Keyword ('+':|[])), NTerminal (Cat' (BaseCat 'E':|"xp")) ]
("Exp '+' Exp",["$1","$3"])
>>>
generatePatterns True [ NTerminal (Cat' (BaseCat 'E':|"xp")), Terminal (Keyword ('+':|[])), NTerminal (Cat' (BaseCat 'E':|"xp")) ]
("Exp '+' Exp",["(snd $1)","(snd $3)"])