úÎ!žÔ”Ø¥      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤Safe&'SX&é EarleyA 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.Earley 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 ¬. Earley4Match a token for which the given predicate returns Just a, and return the a. Earley8A named production (used for reporting expected things). Earley#Smart constructor for alternatives.Earley3Create a new non-terminal by giving its production.EarleyZRun a grammar, given an action to perform on productions to be turned into non-terminals.Earley&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 TextEarleyLifted instance:  mempty = ­ ®EarleyLifted instance: (<>) = ¯ (°)   0None &'4NSXIEarleyDResults ready to be reported (when this position has been processed)Earley&States to process at the next positionEarley<Computation that resets the continuation refs of productions EarleyThe possible tokens!EarleyThe result of a generator."EarleyThe generator ended.#Earley#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.(EarleyA continuation accepting an a and producing a b.+Earley!An Earley state with result type a.5Earley.The concrete rule type that the generator uses<Earley%Remove (some) nulls from a productionBEarleyRStrings of non-ambiguous continuations can be optimised by removing indirections.CEarley,Given a grammar, construct an initial state.FEarleyThe internal generation routineGEarleyICreate a language generator for given grammar and list of allowed tokens.HEarley7Run 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.IEarley 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.JEarley 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.FEarley"States to process at this position1 !#"$%'&(*)+-,.0/123456987:;<=>?@ABCDEFGHIJ156987:;<4=123>.0/+-,(*)$%'&?@ABC!#"D EFGHIJNoneJÄ!"#GHIJ!"#GHIJNoneOYSEarleyMMatch a token that satisfies the given predicate. Returns the matched token.TEarleyMatch a single token.UEarley7Match a single token and give it the name of the token.VEarley#Match a list of tokens in sequence.WEarleyMatch a ² of tokens in sequence.STUVWSTUVWNone &'4NSXt[EarleyDResults ready to be reported (when this position has been processed)\Earley&States to process at the next position]Earley<Computation that resets the continuation refs of productions^Earley.Named productions encountered at this position_Earley(The current position in the input string`EarleyThe input stringaEarleyThe result of a parse.bEarleyThe parser ended.cEarleyThe 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.dEarleyÉ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.fEarleyCThe final position in the input (0-based) that the parser reached.gEarley7The named productions processed at the final position.hEarleyHThe part of the input string that was not consumed, which may be empty.mEarleyA continuation accepting an a and producing a b.pEarley!An Earley state with result type a.zEarley+The concrete rule type that the parser usesEarley%Remove (some) nulls from a production‡EarleyRStrings of non-ambiguous continuations can be optimised by removing indirections.ˆEarley,Given a grammar, construct an initial state.‹EarleyThe internal parsing routineŒEarley'Create a parser from the given grammar.EarleyaReturn 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.ŽEarleyWReturn 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.Earley§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.‹Earley"States to process at this position8XYZ`_^\[]acbdehgfijlkmonprqsutvwxyz{~}|€‚ƒ„…†‡ˆ‰Š‹ŒŽ8z{~}|€y‚vwxƒsutprqmonijlk„…†‡ˆdehgfacb‰YZ`_^\[]Š‹XŒŽNonev… XabcdefghŒŽ defghabcXŒŽNonew# GHIJSTUVWXabcdefghŒŽ STUVWdefghabcXŒŽGHIJNoneN”œœEarley%An identifier with identifier parts (´s), and holes (µ0s) representing the positions of its arguments.-Example (commonly written "if_then_else_"): [´ "if", µ, ´ "then", µ, ´ "else", µ] :: œ §¡Earley0Create a grammar for parsing mixfix expressions.¢Earley A version of ¡6 with a separate semantic action for each individual œ identifier.¡Earley²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.EarleyAn atom, i.e. what is parsed at the lowest level. This will commonly be a (non-mixfix) identifier or a parenthesised expression.EarleyeHow to combine the successful application of a holey identifier to its arguments into an expression.¢EarleyÈ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.EarleyAn atom, i.e. what is parsed at the lowest level. This will commonly be a (non-mixfix) identifier or a parenthesised expression.œžŸ ¡¢žŸ œ¡¢¶      !"#$$%&'()*+,,-.//0112345667899:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\%&']^_)*`aabcd,,-.//0112345667899:;<=>?@ABCDEFGefghijNOPQRSTklmnUopqrstuvwxyzx{|xy}~€~xy‚xyƒxy„xy…xy†xy‡xyˆx‰Š‹ŒxŽŠxx‘’&Earley-0.13.0.0-9meU7CHc5KtBrLcqN5qDRJText.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 namedTokenlistlistLikeParserParseEnvnamescurPosinputParsedReportpositionexpected unconsumed emptyParseEnvparseparser allParses fullParsesreport $fEqReport $fOrdReport $fReadReport $fShowReportHoley Associativity LeftAssocNonAssoc RightAssocmixfixExpressionmixfixExpressionSeparate$fEqAssociativity$fShowAssociativitybaseGHC.BaseMonadControl.Monad.FixMonadFixStringghc-prim GHC.TypesCharIntFunctor Applicative AlternativepurememptyliftA2<>Control.Monad.ST.Lazy.ImpST#ListLike-4.6-8aiSE1DySrY1CvS4QVhLKoData.ListLike.BaseListLikeGHC.ST GHC.MaybeJustNothing