úÎ!5x³…      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~  € ‚ ƒ „ Safeãrere A vendored  from *https://hackage.haskell.org/package/boring We only need Void instance.rere fmap absurd.Safe}rere A set of …s.)We use range set, which works great with ….rereEmpty character set.rereuniverse size universe1114112universe)CS.fromIntervalList [('\NUL','\1114111')]rereCheck whether  is .rereSize of .size $ fromIntervalList [('a','f'), ('0','9')]169length $ toList $ fromIntervalList [('a','f'), ('0','9')]16 rereSingleton character set. rere%Test whether character is in the set. rereInsert … into . rere Union of two s. rereIntersection of two s†rereCompute the intersection.rereComplement of a CharSet‡rere(Compute the complement intersected with [x,) assuming x<u.ˆrere(Compute the complement intersected with (x,).‰rereCompute the complement.NNote: we treat Ints as codepoints, i.e minBound is 0, and maxBound is 0x10ffffrereDifference of two s.rereMake ! from a list of characters, i.e. Š.rereConvert  to a list of characters i.e. Š.rereConvert to interval list&toIntervalList $ union "01234" "56789" [('0','9')]rereConvert from interval pairs.fromIntervalList []""'fromIntervalList [('a','f'), ('0','9')]"0123456789abcdef"fromIntervalList [('Z','A')]""rere"foobar" :: CharSet"abfor"    Safe;‹ŒŽSafe456 «rereINames carry information used in pretty-printing, but otherwise they all ‘ ’ual.rere is essentially “.rereboundrerefree variable.rere Analogue of ” for .rereSwap variables.rere3Make a name for derivative binding (adds subindex).Safe4562+rere$Regular expression with fixed point.6rereCMatch string by iteratively differentiating the regular expression.%This version is slow, consider using .7rerekWhether the regular expression accepts empty string, or whether the formal language contains empty string. nullable EpsTruenullable (ch_ 'c')False8rere:Derivative of regular exression to respect of character. 8 c r is D_c(r).9rere: and 9‚ are slightly different implementations internally. We are interested in comparing whether either one is noticeably faster (no).:rere: and 9‚ are slightly different implementations internally. We are interested in comparing whether either one is noticeably faster (no).;rereSize of +. Counts constructors.<rereRe-apply smart constructors on +0 structure, thus potentially making it smaller.This function is slow.=rereVariable substitution.>rereSmart /, as it takes … argument.?rereConstruct literal Š regex.@rereSmart 2.ArereSmart 4BrereSmart 5.CrereSmart 1.•rere expressionrere float out varrerebinderrere(maybe an expression with let floaten out+31052-,./46789:;<=>?@ABC+31052-,./4>C@AB=?786<;:9=4C5Safe8íOrere<Character classes are represented by partition lower bounds.PrereCharacter classes.We can partition …R so characters in each part, affect the given regular expression in the same way.?If we do some kind of memoising, we can map all characters to Q, making everything smaller.Qrere'Map char to the representer of a class.OPQOPQSafeX<ïRrere'Knot-tied recursive regular expression.–rereConvert + to R.SrereConvert + to R and then match.Significantly faster than .TrereMatch and print final RR + stats.—rereWhether R is nullable. 7 re = — (– re) RSTRSTSafe@ÛWrere'Knot-tied recursive regular expression.˜rereConvert + to W.XrereConvert + to W and then match.Significantly faster than .YrereMatch and print final W + stats.™rereWhether W is nullable. 7 re = ™ (˜ re) WXYWXYSafeCä\rereGenerate strings.,runGen 42 $ generate 10 10 $ star_ (ch_ 'a')"aaa",runGen 44 $ generate 10 10 $ star_ (ch_ 'a') "aaaaaaaaaa"\rerestar upper sizerere fix unroll\\  Trustworthy&'.XMÔ]rere1Single equation in context-free-grammar equation.^rere$Context-free grammar represented as n equations of + (]) with n variables._rereConvert ^# (with names for productions) into +3. Note: the start symbol have to be last equation.'let a = Eps \/ ch_ 'a' <> Var (Left FZ),let b = Eps \/ ch_ 'b' <> Var (Left (FS FZ))let cfg = b ::: a ::: VNil‹[ begin{aligned} {mathit{b}} &= {varepsilon}cupmathtt{b}{mathit{a}} -- {mathit{a}} &= {varepsilon}cupmathtt{a}{mathit{b}} -- end{aligned}šrere expressionrere float out varrerebinderrere(maybe an expression with let floaten out]^_^]_  Trustworthy&'XPã`rere Pretty-print + as LaTeX code.arereRun 6C variant, collect intermediate steps, and pretty-print that trace.brere Pretty-print ^ given the names.`ab`abSafeQ9,+31052-,./4678;<=>?@ABCOPQRSTWXY\]^_`ab,+31052-,./4>C@AB=?78<;6\^]_WXYRSTOPQ`ab  Trustworthy&'XZlrereSize of JSON grammar, 22.mrere3JSON recursive regular expression constructor from o. m = < (_ n o) ZThe conversion doesn't optimize the resulting regular expression, but is relatively fast. size (cfgToRE jsonNames jsonCFG)232p is pre-calculated variant. size jsonRE205nrere Names of o productions.orere JSON grammarprere2Pre-calculated JSON grammar as regular expression. size jsonRE205See m for one constructed from o.lmnoplmnop  Trustworthyxqrere9Demonstrates how various constructors are pretty printed.rrerematch ex1 "abab"Truematch ex1 "ababa"Falseex1Star (App (Ch "a") (Ch "b"))charClasses ex1fromList "\NULabc" showRef ex1size: 4"show: Star (App (Ch "a") (Ch "b")) null: TruematchR ex1 "abab"TruematchR ex1 "ababa"FalserunGen 42 (generate 10 20 ex1)"ababab"runGen 44 (generate 10 20 ex1)"abababababababababab"trerematch ex2 "aaa"True!Note: how "sharing" is preserved. showRef ex2size: 5)show: App (Star (Ch "a")) (Star (Ch "a")) null: True > matchR ex2 "aaa"TruerunGen 42 (generate 10 20 ex2) "aaaaaaaaaaa"runGen 44 (generate 10 20 ex2) "aaaaaaaaaa"vrerematch ex3 "abab"Truematch ex3 "ababa"False showRef ex3size: 8Dshow: Ref 0 (Alt Eps (App (Ch "a") (App (Ch "b") (Ref 0 <<loop>>)))) null: TruematchR ex3 "abab"TruematchR ex3 "ababa"FalserunGen 42 (generate 10 20 ex3)"ab"runGen 50 (generate 10 20 ex3)"ababab"xrerematch ex4 "aaaabbbb"True showRef ex4size: 8Dshow: Ref 0 (Alt Eps (App (Ch "a") (App (Ref 0 <<loop>>) (Ch "b")))) null: TruematchR ex4 "aaaabbbb"TruerunGen 42 (generate 10 20 ex4)"aabb"runGen 45 (generate 10 20 ex4)"aaabbb"zrerematch ex5 "abab"Truematch ex5 "ababa"False showRef ex5size: 8Dshow: Ref 0 (Alt Eps (App (Ref 0 <<loop>>) (App (Ch "a") (Ch "b")))) null: TruematchR ex5 "abab"TruematchR ex5 "ababa"FalserunGen 42 (generate 10 20 ex5)"ab"runGen 45 (generate 10 20 ex5)"ababab"|rereUsing fix-point operator: Pfix expr = "(" expr ")" | "1" | "2" | ... | "9" | expr "+" expr | expr "*" expr which in BNF is almost he same Nexpr ::= "(" expr ")" | "1" | "2" | ... | "9" | expr "+" expr | expr "*" expr matchR ex6 "(1+2)*3"TruerunGen 42 (generate 5 5 ex6)"96+(09493+90790)*19"€rerematchR ex7 "12"TruematchR ex7 "(1+2)*3"TruecharClasses ex7fromList "\NUL()*+,0:"runGen 42 (generate 5 5 ex7)B"(0181+912595*00+((1228)+467+(80)+(216406))*(65)+4+5*5149+994734)"qrstuvwxyz{|}~€‚ƒ„qrstuvwxyz{|}~€‚ƒ„› !"#$%&'()*+,-./0123456789:;<=>?@ABC+DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgdh i j k l m n o p q r s t u v w x y z { | } ~  € ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž ‘’“”•–—˜™š › œ ž Ÿ  ‘¡¢‘’£˜¤¥˜¦§¨©ª©ª ¨«rere-0.1-28PuoekFw1Q8K8VDItQQ06 RERE.Absurd RERE.CharSetRERE.Var RERE.TypeRERE.CharClassesRERE.STRERE.RefRERE.GenRERE.CFG RERE.LaTeXRERE.Examples.JSON RERE.Examples RERE.TuplesREREmatchRmatchAbsurdabsurdvacuous $fAbsurdVoidCharSetemptyuniversenullsize singletonmemberinsertunion intersection complement differencefromListtoListtoIntervalListfromIntervalList $fShowCharSet$fIsStringCharSet $fEqCharSet $fOrdCharSetNameNVarBFunvarswapVarderivativeName $fIsStringVar$fIsStringName $fOrdName$fEqName $fShowName$fEqVar$fOrdVar $fShowVar $fFunctorVar $fFoldableVar$fTraversableVarRENullFullEpsChAppAltStarLetFixnullable derivative derivative2 derivative1compact>>>=ch_string_star_let_fix_\/ $fSemigroupRE $fArbitraryRE $fMonadRE$fApplicativeRE $fIsStringRE$fEqRE$fOrdRE$fShowRE $fFunctorRE $fFoldableRE$fTraversableRE CharClasses charClasses classOfCharRSTmatchST matchDebugST $fShowRST$fShowBoolExprRR matchDebugR$fShowRRgenerateCFGBaseCFGcfgToREputLatex putLatexTrace putLatexCFG $fMonoidPiece$fSemigroupPiece$fIsStringPiece$fEqPrec $fOrdPrec $fEnumPrec $fShowPrec$fEqNI$fOrdNISizejsonRE' jsonNamesjsonCFGjsonREsyntaxExamplesex1ex1run1ex2ex2run1ex3ex3run1ex4ex4run1ex5ex5run1ex6ex6run1exCfgexCfgNex7ex7run1ex7run ex7parsec ex7parsecRunghc-prim GHC.TypesCharintersectRangeListcomplementRangeList'complementRangeList''complementRangeListbaseGHC.BaseStringTripleTbimapfstOf3sndOf3trdOf3 GHC.ClassescompareEQ GHC.MaybeMaybe Data.MaybemaybefloatOutfromRE nullableR