cryptol-2.11.0: Cryptol: The Language of Cryptography
Copyright(c) 2013-2016 Galois Inc.
LicenseBSD3
Maintainercryptol@galois.com
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Cryptol.Eval

Description

 
Synopsis

Documentation

moduleEnv Source #

Arguments

:: EvalPrims sym 
=> sym 
-> Module

Module containing declarations to evaluate

-> GenEvalEnv sym

Environment to extend

-> SEval sym (GenEvalEnv sym) 

Extend the given evaluation environment with all the declarations contained in the given module.

runEval :: CallStack -> Eval a -> IO a Source #

Execute the given evaluation action.

data EvalOpts Source #

Some options for evalutaion

Constructors

EvalOpts 

Fields

data PPOpts Source #

How to pretty print things when evaluating

Instances

Instances details
Show PPOpts Source # 
Instance details

Defined in Cryptol.Utils.PP

data Eval a Source #

The monad for Cryptol evaluation. A computation is either "ready", which means it represents only trivial computation, or is an "eval" action which must be computed to get the answer, or it is a "thunk", which represents a delayed, shared computation.

Instances

Instances details
Monad Eval Source # 
Instance details

Defined in Cryptol.Backend.Monad

Methods

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

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

return :: a -> Eval a #

Functor Eval Source # 
Instance details

Defined in Cryptol.Backend.Monad

Methods

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

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

Applicative Eval Source # 
Instance details

Defined in Cryptol.Backend.Monad

Methods

pure :: a -> Eval a #

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

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

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

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

MonadIO Eval Source # 
Instance details

Defined in Cryptol.Backend.Monad

Methods

liftIO :: IO a -> Eval a #

emptyEnv :: GenEvalEnv sym Source #

Evaluation environment with no bindings

evalExpr Source #

Arguments

:: (?range :: Range, EvalPrims sym) 
=> sym 
-> GenEvalEnv sym

Evaluation environment

-> Expr

Expression to evaluate

-> SEval sym (GenValue sym) 

Evaluate a Cryptol expression to a value. This evaluator is parameterized by the EvalPrims class, which defines the behavior of bits and words, in addition to providing implementations for all the primitives.

evalDecls Source #

Arguments

:: EvalPrims sym 
=> sym 
-> [DeclGroup]

Declaration groups to evaluate

-> GenEvalEnv sym

Environment to extend

-> SEval sym (GenEvalEnv sym) 

Extend the given evaluation environment with the result of evaluating the given collection of declaration groups.

evalNewtypeDecls :: EvalPrims sym => sym -> Map Name Newtype -> GenEvalEnv sym -> SEval sym (GenEvalEnv sym) Source #

evalSel :: Backend sym => sym -> GenValue sym -> Selector -> SEval sym (GenValue sym) Source #

Apply the the given "selector" form to the given value. This function pushes tuple and record selections pointwise down into other value constructs (e.g., streams and functions).

evalSetSel :: forall sym. Backend sym => sym -> TValue -> GenValue sym -> Selector -> SEval sym (GenValue sym) -> SEval sym (GenValue sym) Source #

data EvalError Source #

Data type describing errors that can occur during evaluation.

Constructors

InvalidIndex (Maybe Integer)

Out-of-bounds index

DivideByZero

Division or modulus by 0

NegativeExponent

Exponentiation by negative integer

LogNegative

Logarithm of a negative integer

UserError String

Call to the Cryptol error primitive

LoopError String

Detectable nontermination

NoPrim Name

Primitive with no implementation

BadRoundingMode Integer

Invalid rounding mode

BadValue String

Value outside the domain of a partial function.

Instances

Instances details
Show EvalError Source # 
Instance details

Defined in Cryptol.Backend.Monad

PP EvalError Source # 
Instance details

Defined in Cryptol.Backend.Monad

Methods

ppPrec :: Int -> EvalError -> Doc Source #

data Unsupported Source #

Constructors

UnsupportedSymbolicOp String

Operation cannot be supported in the symbolic simulator

data WordTooWide Source #

Constructors

WordTooWide Integer

Bitvector too large

forceValue :: Backend sym => GenValue sym -> SEval sym () Source #

Force the evaluation of a value