value
cf2Printer Derive pretty-printer from a BNF grammar.
:: a typeCtrl KGHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11
ModuleBNFC-2.9.6.3Haskell2010
cf2Printer Derive pretty-printer from a BNF grammar.
Define an ordering on lists' rules with the following properties:
rules with a higher coercion level should come first, i.e. the rules for [Foo3] are before rules for [Foo1] and they are both lower than rules for [Foo].
[] < [_] < _:_
This is desiged to correctly order the rules in the prt function for lists so that the pattern matching works as expectd.
compareRules (npRule "[]" (ListCat (CoercCat "Foo" 3)) [] Parsable) (npRule "[]" (ListCat (CoercCat "Foo" 1)) [] Parsable)LT
compareRules (npRule "[]" (ListCat (CoercCat "Foo" 3)) [] Parsable) (npRule "[]" (ListCat (Cat "Foo")) [] Parsable)LT
compareRules (npRule "[]" (ListCat (Cat "Foo")) [] Parsable) (npRule "(:[])" (ListCat (Cat "Foo")) [] Parsable)LT
compareRules (npRule "(:[])" (ListCat (Cat "Foo")) [] Parsable) (npRule "(:)" (ListCat (Cat "Foo")) [] Parsable)LT