Copyright | Benjamin Jones <bjones@galois.com> 2016-2017 |
---|---|
License | BSD3 |
Maintainer | bjones@galois.com |
Stability | experimental |
Portability | unknown |
Safe Haskell | Safe |
Language | Haskell2010 |
Better constructors for Sally expresssions and predicates than the raw ones defined in Language.Sally.Types.
- boolExpr :: Bool -> SallyExpr
- boolPred :: Bool -> SallyPred
- intExpr :: Integral a => a -> SallyExpr
- zeroExpr :: SallyExpr
- oneExpr :: SallyExpr
- realExpr :: Real a => a -> SallyExpr
- addExpr :: SallyExpr -> SallyExpr -> SallyExpr
- subExpr :: SallyExpr -> SallyExpr -> SallyExpr
- multExpr :: SallyExpr -> SallyExpr -> SallyExpr
- divExpr :: SallyExpr -> SallyExpr -> SallyExpr
- notExpr :: SallyExpr -> SallyExpr
- eqExpr :: SallyExpr -> SallyExpr -> SallyExpr
- neqExpr :: SallyExpr -> SallyExpr -> SallyExpr
- ltExpr :: SallyExpr -> SallyExpr -> SallyExpr
- leqExpr :: SallyExpr -> SallyExpr -> SallyExpr
- gtExpr :: SallyExpr -> SallyExpr -> SallyExpr
- geqExpr :: SallyExpr -> SallyExpr -> SallyExpr
- muxExpr :: SallyExpr -> SallyExpr -> SallyExpr -> SallyExpr
- andExprs :: [SallyExpr] -> SallyExpr
- andPreds :: [SallyPred] -> SallyPred
- orExprs :: [SallyExpr] -> SallyExpr
- varExpr :: SallyVar -> SallyExpr
- varExpr' :: Name -> SallyExpr
- xorExpr :: SallyExpr -> SallyExpr -> SallyExpr
- minExpr :: [SallyExpr] -> Maybe SallyExpr -> SallyExpr
- countExpr :: SallyExpr -> [SallyExpr] -> SallyExpr
- constFold :: SallyExpr -> SallyExpr
- simplifyAnds :: SallyPred -> SallyPred
- simplifyOrs :: SallyPred -> SallyPred
- flattenAnds :: Seq SallyPred -> Seq SallyPred
- flattenOrs :: Seq SallyPred -> Seq SallyPred
better constructors
addExpr :: SallyExpr -> SallyExpr -> SallyExpr Source #
Better constructor for adding expressions TODO maintain normal form
multExpr :: SallyExpr -> SallyExpr -> SallyExpr Source #
Better constructor for multiplying expressions; checks that one of the operands is a constant.
divExpr :: SallyExpr -> SallyExpr -> SallyExpr Source #
Better constructor for dividing expressions; checks that the denominator is a constant.
notExpr :: SallyExpr -> SallyExpr Source #
Create the expression that is the boolean negation of the given one.
eqExpr :: SallyExpr -> SallyExpr -> SallyExpr Source #
Create the expression equating two given expressions.
neqExpr :: SallyExpr -> SallyExpr -> SallyExpr Source #
Create the expression representing non-equality.
leqExpr :: SallyExpr -> SallyExpr -> SallyExpr Source #
a
represents the expression leqExpr
ba <= b
.
geqExpr :: SallyExpr -> SallyExpr -> SallyExpr Source #
a
represents the expression geqExpr
ba >= b
.
muxExpr :: SallyExpr -> SallyExpr -> SallyExpr -> SallyExpr Source #
Create an if-then-else expression: mux b x y
represents the statement
"if b then x else y".
andExprs :: [SallyExpr] -> SallyExpr Source #
Form the conjunction of the given expressions (which should be predicates, but this is not checked).
andPreds :: [SallyPred] -> SallyPred Source #
And over multiple predicates, doing some small inline simplification
orExprs :: [SallyExpr] -> SallyExpr Source #
Form the disjunction of the given expressions (which should be predicates, but this is not checked).
complex expression builders
minExpr :: [SallyExpr] -> Maybe SallyExpr -> SallyExpr Source #
Given a non-empty finite list of expressions, build an expression to compute their minimum. The second argument is a special value which, if present causes expressions in the list with this value to be ignored in the calculation. If the input list contains only the special value, then the special value itself is returned.
countExpr :: SallyExpr -> [SallyExpr] -> SallyExpr Source #
Build a Sally expression representing the number of times a particular item appears in a list of expressions.
expression rewriting
simplifyAnds :: SallyPred -> SallyPred Source #
Top-down rewriting of and
terms including constant folding and
constructor reduction.
simplifyOrs :: SallyPred -> SallyPred Source #
Top-down rewriting of or
terms including constant folding and
constructor reduction.