polyparse-1.13: A variety of alternative parser combinator libraries.

CopyrightGraham Hutton (University of Nottingham) Erik Meijer (University of Utrecht)
LicenseBSD
MaintainerMalcolm Wallace <Malcolm.Wallace@cs.york.ac.uk>
StabilityStable
PortabilityAll A LIBRARY OF MONADIC PARSER COMBINATORS 29th July 1996 Graham Hutton Erik Meijer University of Nottingham University of Utrecht
Safe HaskellSafe
LanguageHaskell98

Text.ParserCombinators.HuttonMeijer

Description

This Haskell script defines a library of parser combinators, and is taken from sections 1-6 of our article "Monadic Parser Combinators". Some changes to the library have been made in the move from Gofer to Haskell:

  • Do notation is used in place of monad comprehension notation;
  • The parser datatype is defined using "newtype", to avoid the overhead of tagging and untagging parsers with the P constructor.
Synopsis

Documentation

newtype Parser a Source #

The parser monad

Constructors

P ([Token] -> [(a, [Token])]) 
Instances
Monad Parser Source # 
Instance details

Defined in Text.ParserCombinators.HuttonMeijer

Methods

(>>=) :: Parser a -> (a -> Parser b) -> Parser b #

(>>) :: Parser a -> Parser b -> Parser b #

return :: a -> Parser a #

fail :: String -> Parser a #

Functor Parser Source # 
Instance details

Defined in Text.ParserCombinators.HuttonMeijer

Methods

fmap :: (a -> b) -> Parser a -> Parser b #

(<$) :: a -> Parser b -> Parser a #

MonadFail Parser Source # 
Instance details

Defined in Text.ParserCombinators.HuttonMeijer

Methods

fail :: String -> Parser a #

Applicative Parser Source # 
Instance details

Defined in Text.ParserCombinators.HuttonMeijer

Methods

pure :: a -> Parser a #

(<*>) :: Parser (a -> b) -> Parser a -> Parser b #

liftA2 :: (a -> b -> c) -> Parser a -> Parser b -> Parser c #

(*>) :: Parser a -> Parser b -> Parser b #

(<*) :: Parser a -> Parser b -> Parser a #

Alternative Parser Source # 
Instance details

Defined in Text.ParserCombinators.HuttonMeijer

Methods

empty :: Parser a #

(<|>) :: Parser a -> Parser a -> Parser a #

some :: Parser a -> Parser [a] #

many :: Parser a -> Parser [a] #

MonadPlus Parser Source # 
Instance details

Defined in Text.ParserCombinators.HuttonMeijer

Methods

mzero :: Parser a #

mplus :: Parser a -> Parser a -> Parser a #

item :: Parser Token Source #

papply :: Parser a -> [Token] -> [(a, [Token])] Source #

(+++) :: Parser a -> Parser a -> Parser a infixr 5 Source #

sat :: (Token -> Bool) -> Parser Token Source #

many :: Parser a -> Parser [a] Source #

many1 :: Parser a -> Parser [a] Source #

sepby :: Parser a -> Parser b -> Parser [a] Source #

sepby1 :: Parser a -> Parser b -> Parser [a] Source #

chainl :: Parser a -> Parser (a -> a -> a) -> a -> Parser a Source #

chainl1 :: Parser a -> Parser (a -> a -> a) -> Parser a Source #

chainr :: Parser a -> Parser (a -> a -> a) -> a -> Parser a Source #

chainr1 :: Parser a -> Parser (a -> a -> a) -> Parser a Source #

ops :: [(Parser a, b)] -> Parser b Source #

bracket :: Parser a -> Parser b -> Parser c -> Parser b Source #