úÎ˜ŌŽäĻ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĒĢĪĨͧSafe&'QV$ûA context-free grammar.The type parameters are:a*: The return type of the grammar (often a ).rI for rule: The type of a non-terminal. This plays a role similar to the s in the type ST s a . Since the parser function expects the rz to be universally quantified, there is not much to do with this parameter other than leaving it universally quantified.Most of the functionality of ,s is obtained through its instances, e.g. Ļ and Đ). Note that GHC has syntactic sugar for Đ: use {-# LANGUAGE RecursiveDo #-} and mdo instead of do. A production.The type parameters are:a$: The return type of the production.tJ for terminal: The type of the terminals that the production operates on.eN for expected: The type of names, used for example to report expected tokens.rI for rule: The type of a non-terminal. This plays a role similar to the s in the type ST s a . Since the parser function expects the rz to be universally quantified, there is not much to do with this parameter other than leaving it universally quantified.As an example,  r Š Ŧ Ž. is the type of a production that returns an Ž0, operates on (lists of) characters and reports Š names.Most of the functionality of +s is obtained through its instances, e.g. ­, Ū, and Ŋ. 4Match a token for which the given predicate returns Just a, and return the a. 8A named production (used for reporting expected things). #Smart constructor for alternatives.3Create a new non-terminal by giving its production.ZRun a grammar, given an action to perform on productions to be turned into non-terminals.&String literals can be interpreted as s that match that string.:set -XOverloadedStringsimport Data.Text (Text)=let determiner = "the" <|> "a" <|> "an" :: Prod r e Text Text    0None &'3LQVEZDResults ready to be reported (when this position has been processed)&States to process at the next position<Computation that resets the continuation refs of productions The possible tokens!The result of a generator."The generator ended.##The generator produced a number of a's. These are given as a computation, ° s [a] that constructs the as when run. The Žn is the position in the input where these results were obtained, and the last component is the continuation.(A continuation accepting an a and producing a b.+!An Earley state with result type a.5.The concrete rule type that the generator uses<%Remove (some) nulls from a productionBRStrings of non-ambiguous continuations can be optimised by removing indirections.C,Given a grammar, construct an initial state.FThe internal generation routineGICreate a language generator for given grammar and list of allowed tokens.H7Run a generator, returning all members of the language.ĸ!The members are returned as parse results paired with the list of tokens used to produce the result. The elements of the returned list of results are sorted by their length in ascending order. If there are multiple results of the same length they are returned in an unspecified order.I upTo n gen runs the generator genR, returning all members of the language that are of length less than or equal to n.ĸ!The members are returned as parse results paired with the list of tokens used to produce the result. The elements of the returned list of results are sorted by their length in ascending order. If there are multiple results of the same length they are returned in an unspecified order.J exactly n gen runs the generator genE, returning all members of the language that are of length equal to n.ŊThe members are returned as parse results paired with the list of tokens used to produce the result. If there are multiple results they are returned in an unspecified order.F"States to process at this position1 !#"$%'&(*)+,-.0/123456987:;<=>?@ABCDEFGHIJ656789:;<4=123>ONMLK./0+,-()*$%&'?@ABC!"#D EFGHIJ !"#$%&'()*+,-./012356789NoneGŪ!"#GHIJ!"#GHIJNoneKÃSMMatch a token that satisfies the given predicate. Returns the matched token.TMatch a single token.U7Match a single token and give it the name of the token.V#Match a list of tokens in sequence.WMatch a ą of tokens in sequence.STUVWXYZSTUVWXYZNone &'3LQVn‰^DResults ready to be reported (when this position has been processed)_&States to process at the next position`<Computation that resets the continuation refs of productionsa.Named productions encountered at this positionb(The current position in the input stringcThe input stringdThe result of a parse.eThe parser ended.fThe parser parsed a number of a's. These are given as a computation, ē s [a] that constructs the aps when run. We can thus save some work by ignoring this computation if we do not care about the results. The ŽF is the position in the input where these results were obtained, the iD the rest of the input, and the last component is the continuation.gÉA parsing report, which contains fields that are useful for presenting errors to the user if a parse is deemed a failure. Note however that we get a report even when we successfully parse something.iCThe final position in the input (0-based) that the parser reached.j7The named productions processed at the final position.kHThe part of the input string that was not consumed, which may be empty.pA continuation accepting an a and producing a b.s!An Earley state with result type a.}+The concrete rule type that the parser uses„%Remove (some) nulls from a productionŠRStrings of non-ambiguous continuations can be optimised by removing indirections.‹,Given a grammar, construct an initial state.ŽThe internal parsing routine'Create a parser from the given grammar.aReturn all parses from the result of a given parser. The result may contain partial parses. The Ž3s are the position at which a result was produced.ūThe elements of the returned list of results are sorted by their position in ascending order. If there are multiple results at the same position they are returned in an unspecified order.‘WReturn all parses that reached the end of the input from the result of a given parser.HIf there are multiple results they are returned in an unspecified order.’§See e.g. how far the parser is able to parse the input string before it fails. This can be much faster than getting the parse results for highly ambiguous grammars.Ž"States to process at this position8[\]cba_^`dfeghkjilmonprqstuvxwyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’=}~€‚ƒ„|…yz{†—–•”“vwxstupqrlmno‡ˆ‰Š‹ghijkdefŒ\]^_`abcŽ[‘’ \]^_`abcdefghijklmnopqrstuvwxyz{}~€Noneq2 [defghijk‘’ ghijkdef[‘’NoneqŌ GHIJSTUVWXYZ[defghijk‘’ STUVWXYZghijkdef[‘’GHIJNoneLŽ•Ÿ%An identifier with identifier parts (ģs), and holes (ī0s) representing the positions of its arguments.-Example (commonly written "if_then_else_"): [ģ "if", ī, ģ "then", ī, ģ "else", ī] :: Ÿ ŠĪ0Create a grammar for parsing mixfix expressions.Ĩ A version of Ī6 with a separate semantic action for each individual Ÿ identifier.ĪēA table of holey identifier parsers, with associativity information. The identifiers should be in groups of precedence levels listed from binding the least to the most tightly.ŧThe associativity is taken into account when an identifier starts or ends with holes, or both. Internal holes (e.g. after "if" in "if_then_else_") start from the beginning of the table.Note that this rule also applies to identifiers with multiple consecutive holes, e.g. "if__" --- the associativity then applies to both holes.An atom, i.e. what is parsed at the lowest level. This will commonly be a (non-mixfix) identifier or a parenthesised expression.eHow to combine the successful application of a holey identifier to its arguments into an expression.ĨČA table of holey identifier parsers, with associativity information and semantic actions. The identifiers should be in groups of precedence levels listed from binding the least to the most tightly.ŧThe associativity is taken into account when an identifier starts or ends with holes, or both. Internal holes (e.g. after "if" in "if_then_else_") start from the beginning of the table.Note that this rule also applies to identifiers with multiple consecutive holes, e.g. "if__" --- the associativity then applies to both holes.An atom, i.e. what is parsed at the lowest level. This will commonly be a (non-mixfix) identifier or a parenthesised expression.Ÿ ĄĒĢĪĨ ĄĒ̟ĪĨ ĄĒĢĩ      !"#$$%&'()*+,,-.//0112345667899:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^__%&'`ab)*cddefg,,-.//0112345667899:;<=>?@ABCDEFGhijklmNOPQRSTnopqUrstuvwxyz{|}{~{|€‚ƒ‚„{|…{|†{|‡{ˆ‰Š‹Œ{‰{|Ž{|&Earley-0.12.1.0-DaPevxvx6HpA0F6BcfoFgRText.Earley.GrammarText.Earley.Generator.InternalText.Earley.DerivedText.Earley.Parser.InternalText.Earley.MixfixText.Earley.GeneratorText.Earley.Parser Text.EarleyGrammarRuleBindFixBindReturnProdTerminal NonTerminalPureAltsManyNamedterminalaltsrule runGrammar$fIsStringProd$fAlternativeProd$fApplicativeProd $fFunctorProd $fMonoidProd$fSemigroupProd$fMonadFixGrammar$fMonadGrammar$fApplicativeGrammar$fFunctorGrammar Generator GenerationEnvresultsnextresettokensResultEnded GeneratedContsconts contsArgsCont FinalContStateFinalBirthPosPreviousCurrentResults unResultsProdRRuleruleProd ruleConts ruleNullsmkRule prodNulls removeNulls resetConts lazyResultsnewConts contraMapCont contToState simplifyCont initialStatesafeHeademptyGenerationEnvgenerate generatorlanguageupToexactly$fMonoidResults$fSemigroupResults$fMonadResults$fAlternativeResults$fApplicativeResults$fFunctorResults $fEqBirthPos$fFunctorResultsatisfytoken namedTokenlistlistLikesymbol namedSymbolwordParserParseEnvnamescurPosinputParsedReportpositionexpected unconsumed emptyParseEnvparseparser allParses fullParsesreport $fEqReport $fOrdReport $fReadReport $fShowReportHoley Associativity LeftAssocNonAssoc RightAssocmixfixExpressionmixfixExpressionSeparate$fEqAssociativity$fShowAssociativitybaseGHC.BaseMonadControl.Monad.FixMonadFixStringghc-prim GHC.TypesCharIntFunctor Applicative AlternativeControl.Monad.ST.Lazy.ImpST#ListLike-4.6-8DLe6ZnOm5D5kqD5RMOVSwData.ListLike.BaseListLikeGHC.STJustNothing