Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Parser Combinators for GLL parsing inspired by Tom Ridge's P3 OCaml library
- type Parser a = (Visit1, Visit2, Visit3 a)
- parse :: Parser a -> [Token] -> IO [a]
- parseString :: Parser a -> [Char] -> IO [a]
- (<::=>) :: String -> Parser a -> Parser a
- (<:=>) :: String -> Parser a -> Parser a
- (<$>) :: (Ord b, Ord a) => (a -> b) -> Parser a -> Parser b
- (<$) :: (Ord a, Ord b) => a -> Parser b -> Parser a
- (<*>) :: (Ord a, Ord b) => Parser a -> Parser b -> Parser (a, b)
- (*>) :: (Ord a, Ord b) => Parser a -> Parser b -> Parser b
- (<*) :: (Ord a, Ord b) => Parser a -> Parser b -> Parser a
- (<|>) :: Ord a => Parser a -> Parser a -> Parser a
- char :: Char -> Parser Char
- token :: Token -> Parser Token
- data Token
- epsilon :: Parser ()
- satisfy :: Ord a => a -> Parser a
- optional :: Ord a => Parser a -> Parser (Maybe a)
- many :: Ord a => Parser a -> Parser [a]
- some :: Ord a => Parser a -> Parser [a]
- memo :: MemoRef (Set a) -> Parser a -> Parser a
- newMemoTable :: IO (MemoRef a)
- type MemoRef a = IORef (MemoTable a)
- type MemoTable a = IntMap (IntMap a)
Documentation
parseString :: Parser a -> [Char] -> IO [a] Source
Parse a given string of characters
(<:=>) :: String -> Parser a -> Parser a infixl 3 Source
useful for non-recursive definitions (only internally)
(<$>) :: (Ord b, Ord a) => (a -> b) -> Parser a -> Parser b infixl 5 Source
Application of a semantic action.
(<$) :: (Ord a, Ord b) => a -> Parser b -> Parser a infixl 5 Source
Ignore all results and just return the given value
(<*>) :: (Ord a, Ord b) => Parser a -> Parser b -> Parser (a, b) infixl 6 Source
Sequence two parsers, the results of the two parsers are tupled.
(*>) :: (Ord a, Ord b) => Parser a -> Parser b -> Parser b infixl 6 Source
Sequencing, ignoring the result to the left
(<*) :: (Ord a, Ord b) => Parser a -> Parser b -> Parser a infixl 6 Source
Sequencing, ignoring the result to the right
(<|>) :: Ord a => Parser a -> Parser a -> Parser a infixl 4 Source
A choice between two parsers, results of the two are concatenated
many :: Ord a => Parser a -> Parser [a] Source
Apply the given parser many times, 0 or more times (Kleene closure)
some :: Ord a => Parser a -> Parser [a] Source
Apply the given parser some times, 1 or more times (positive closure)
newMemoTable :: IO (MemoRef a) Source