crucible-syntax-0.4.1: A syntax for reading and writing Crucible control-flow graphs
Safe HaskellSafe-Inferred
LanguageHaskell2010

Lang.Crucible.Syntax.ExprParse

Synopsis

Documentation

data SyntaxParse atom a Source #

The default parsing monad. Use its MonadSyntax instance to write parsers.

Instances

Instances details
MonadSyntax atom (SyntaxParse atom) Source # 
Instance details

Defined in Lang.Crucible.Syntax.ExprParse

MonadIO (SyntaxParse atom) Source # 
Instance details

Defined in Lang.Crucible.Syntax.ExprParse

Methods

liftIO :: IO a -> SyntaxParse atom a #

Alternative (SyntaxParse atom) Source # 
Instance details

Defined in Lang.Crucible.Syntax.ExprParse

Methods

empty :: SyntaxParse atom a #

(<|>) :: SyntaxParse atom a -> SyntaxParse atom a -> SyntaxParse atom a #

some :: SyntaxParse atom a -> SyntaxParse atom [a] #

many :: SyntaxParse atom a -> SyntaxParse atom [a] #

Applicative (SyntaxParse atom) Source # 
Instance details

Defined in Lang.Crucible.Syntax.ExprParse

Methods

pure :: a -> SyntaxParse atom a #

(<*>) :: SyntaxParse atom (a -> b) -> SyntaxParse atom a -> SyntaxParse atom b #

liftA2 :: (a -> b -> c) -> SyntaxParse atom a -> SyntaxParse atom b -> SyntaxParse atom c #

(*>) :: SyntaxParse atom a -> SyntaxParse atom b -> SyntaxParse atom b #

(<*) :: SyntaxParse atom a -> SyntaxParse atom b -> SyntaxParse atom a #

Functor (SyntaxParse atom) Source # 
Instance details

Defined in Lang.Crucible.Syntax.ExprParse

Methods

fmap :: (a -> b) -> SyntaxParse atom a -> SyntaxParse atom b #

(<$) :: a -> SyntaxParse atom b -> SyntaxParse atom a #

Monad (SyntaxParse atom) Source # 
Instance details

Defined in Lang.Crucible.Syntax.ExprParse

Methods

(>>=) :: SyntaxParse atom a -> (a -> SyntaxParse atom b) -> SyntaxParse atom b #

(>>) :: SyntaxParse atom a -> SyntaxParse atom b -> SyntaxParse atom b #

return :: a -> SyntaxParse atom a #

MonadPlus (SyntaxParse atom) Source # 
Instance details

Defined in Lang.Crucible.Syntax.ExprParse

Methods

mzero :: SyntaxParse atom a #

mplus :: SyntaxParse atom a -> SyntaxParse atom a -> SyntaxParse atom a #

syntaxParseIO :: IsAtom atom => SyntaxParse atom a -> Syntax atom -> IO (Either (SyntaxError atom) a) Source #

Attempt to parse the given piece of syntax, returning the first success found, or the error(s) with the greatest progress otherwise.

Errors

data SyntaxError atom Source #

Syntax errors explain why the error occurred.

Constructors

SyntaxError (NonEmpty (Reason atom)) 

Instances

Instances details
Show atom => Show (SyntaxError atom) Source # 
Instance details

Defined in Lang.Crucible.Syntax.ExprParse

Methods

showsPrec :: Int -> SyntaxError atom -> ShowS #

show :: SyntaxError atom -> String #

showList :: [SyntaxError atom] -> ShowS #

Eq atom => Eq (SyntaxError atom) Source # 
Instance details

Defined in Lang.Crucible.Syntax.ExprParse

Methods

(==) :: SyntaxError atom -> SyntaxError atom -> Bool #

(/=) :: SyntaxError atom -> SyntaxError atom -> Bool #

printSyntaxError :: IsAtom atom => SyntaxError atom -> Text Source #

Convert an internal error structure into a form suitable for humans to read.

Testing utilities

newtype TrivialAtom Source #

A trivial atom, which is a wrapper around Text, for use when testing the library.

Constructors

TrivialAtom Text 

test :: (HasCallStack, Show a) => Text -> SyntaxParse TrivialAtom a -> IO () Source #

Test a parser on some input, displaying the result.