&J%K     Abstract syntax description.(c) PaweB NowakMIT PaweB Nowak <pawel834@gmail.com> experimentalNone1368 :An abstract syntax description based on semi-isomorphisms.MThis class can be implemented by both parsers and printers (and maybe more?).The usual use is to write a polymorphic syntax description and instantiate it both as a parser and a printer. An example syntax description: +| A simple untyped lambda calculus. data AST = Var Text | App AST AST | Abs Text AST deriving (Show) $(makePrisms ''AST) -- | A variable name. name :: Syntax syn Text => syn Text name = S.takeWhile1 isAlphaNum -- | Encloses a symbol in parentheses. parens :: Syntax syn Text => syn a -> syn a parens m = S.char '(' */ S.spaces_ */ m /* S.spaces_ /* S.char ')' -- | An atom is a variable or an expression in parentheses. atom :: Syntax syn Text => syn AST atom = _Var /$/ name /|/ parens expr -- | An expression of our lambda calculus. expr :: Syntax syn Text => syn AST expr = _App /$/ atom /* S.spaces1 /*/ atom /|/ _Abs /$/ S.char '\\' /* S.spaces_ */ name /* S.spaces /* S.string "->" /* S.spaces /*/ expr /|/ atom#Methods of this class try to mimic Data.Attoparsec.Text interface.Any character.A specific character.#Any character except the given one.%Any character satisfying a predicate.\Transforms a character using a SemiIso and filters out values not satisfying the predicate.A specific string.A string of length n.2Maximal string which elements satisfy a predicate. <Maximal non-empty string which elements satisfy a predicate. 9Maximal string which elements do not satisfy a predicate. CMaximal non-empty string which elements do not satisfy a predicate. =An isomorphism between a sequence and a list of its elements.      Char specific combinators.(c) PaweB NowakMIT PaweB Nowak <pawel834@gmail.com> experimentalNone&=K *Syntax constrainted to sequences of chars.6Accepts zero or more spaces. Generates a single space.1Accepts zero or more spaces. Generates no output.5Accepts one or more spaces. Generates a single space.0Accepts one or more spaces. Generates no output..Accepts a single newline. Generates a newline.         syntax-0.1.0.0 Data.SyntaxData.Syntax.CharSyntaxanyCharcharnotCharsatisfy satisfyWithstringtake takeWhile takeWhile1takeTill takeTill1packed SyntaxCharspacesspaces_spaces1spaces1_ endOfLine