Copyright | (c) Dominik Dietrich, Ewaryst Schulz, DFKI Bremen 2010 |
---|---|
License | GPLv2 or higher, see LICENSE.txt |
Maintainer | Ewaryst.Schulz@dfki.de |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
This module contains the abstract syntax types for EnCL as well as the predefined operator configuration.
- data EXPRESSION
- data EXTPARAM = EP Token String APInt
- data BASIC_ITEM
- newtype BASIC_SPEC = Basic_spec [Annoted BASIC_ITEM]
- data SYMB_ITEMS = Symb_items [SYMB] Range
- newtype SYMB = Symb_id Token
- data SYMB_MAP_ITEMS = Symb_map_items [SYMB_OR_MAP] Range
- data SYMB_OR_MAP
- data OPNAME
- = OP_mult
- | OP_div
- | OP_plus
- | OP_minus
- | OP_neg
- | OP_pow
- | OP_fthrt
- | OP_sqrt
- | OP_abs
- | OP_max
- | OP_min
- | OP_sign
- | OP_cos
- | OP_sin
- | OP_tan
- | OP_cot
- | OP_Pi
- | OP_reldist
- | OP_minimize
- | OP_minloc
- | OP_maximize
- | OP_maxloc
- | OP_factor
- | OP_approx
- | OP_divide
- | OP_factorize
- | OP_int
- | OP_rlqe
- | OP_simplify
- | OP_solve
- | OP_neq
- | OP_lt
- | OP_leq
- | OP_eq
- | OP_gt
- | OP_geq
- | OP_convergence
- | OP_reldistLe
- | OP_in
- | OP_undef
- | OP_failure
- | OP_false
- | OP_true
- | OP_not
- | OP_and
- | OP_or
- | OP_impl
- | OP_ex
- | OP_all
- | OP_hastype
- | OP_real
- data OPID
- data ConstantName
- data OP_ITEM = Op_item [Token] Range
- data VAR_ITEM = Var_item [Token] Domain Range
- data VarDecl = VarDecl Token (Maybe Domain)
- data OpDecl = OpDecl ConstantName [EXTPARAM] [VarDecl] Range
- data EPDecl = EPDecl Token EPDomain (Maybe APInt)
- data EPVal
- getEPVarRef :: EPVal -> Maybe Token
- type Domain = SetOrInterval GroundConstant
- type EPDomain = ClosedInterval EPVal
- data GroundConstant
- cmpFloatToInt :: APFloat -> APInt -> Ordering
- data AssDefinition
- data InstantiatedConstant = InstantiatedConstant {}
- data CMD
- = Ass OpDecl EXPRESSION
- | Cmd String [EXPRESSION]
- | Sequence [CMD]
- | Cond [(EXPRESSION, [CMD])]
- | Repeat EXPRESSION [CMD]
- class OperatorState a where
- data OpInfo = OpInfo {}
- data BindInfo = BindInfo {
- bindingVarPos :: [Int]
- boundBodyPos :: [Int]
- operatorInfo :: [OpInfo]
- operatorInfoMap :: OpInfoMap
- operatorInfoNameMap :: OpInfoNameMap
- operatorBindInfoMap :: BindInfoMap
- mergeOpArityMap :: Ord a => OpInfoArityMap a -> OpInfoArityMap a -> OpInfoArityMap a
- getOpInfoMap :: (OpInfo -> String) -> [OpInfo] -> OpInfoMap
- getOpInfoNameMap :: [OpInfo] -> OpInfoNameMap
- getBindInfoMap :: [OpInfo] -> BindInfoMap
- lookupOpInfo :: OpInfoNameMap -> OPID -> Int -> Either Bool OpInfo
- lookupOpInfoForParsing :: OpInfoMap -> String -> Int -> Either Bool OpInfo
- lookupBindInfo :: OpInfoNameMap -> OPID -> Int -> Maybe BindInfo
- type APInt = Integer
- type APFloat = Rational
- toFraction :: APFloat -> (Integer, Integer)
- fromFraction :: Integer -> Integer -> APFloat
- type OpInfoMap = OpInfoArityMap String
- type OpInfoNameMap = OpInfoArityMap OPNAME
- type BindInfoMap = Map String OpInfo
- showOPNAME :: OPNAME -> String
- maxPrecedence :: Int
Documentation
data EXPRESSION
Datatype for expressions
Var Token | |
Op OPID [EXTPARAM] [EXPRESSION] Range | |
List [EXPRESSION] Range | |
Interval Double Double Range | |
Int APInt Range | |
Rat APFloat Range |
Eq EXPRESSION | |
Data EXPRESSION | |
Ord EXPRESSION | |
Show EXPRESSION | |
ShATermConvertible EXPRESSION | |
GetRange EXPRESSION | |
Pretty EXPRESSION | |
Typeable * EXPRESSION | |
Logic CSL () BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol [EXPRESSION] | Instance of Logic for reduce logc |
data EXTPARAM
Extended Parameter Datatype
data BASIC_ITEM
basic items: an operator, extended parameter or variable declaration or an axiom
newtype BASIC_SPEC
Data BASIC_SPEC | |
Show BASIC_SPEC | |
ShATermConvertible BASIC_SPEC | |
Monoid BASIC_SPEC | |
GetRange BASIC_SPEC | |
Pretty BASIC_SPEC | |
Typeable * BASIC_SPEC | |
Syntax CSL BASIC_SPEC Symbol SYMB_ITEMS SYMB_MAP_ITEMS | Syntax of CSL logic |
StaticAnalysis CSL BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol | Static Analysis for reduce logic |
Logic CSL () BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol [EXPRESSION] | Instance of Logic for reduce logc |
data SYMB_ITEMS
symbol lists for hiding
Eq SYMB_ITEMS | |
Data SYMB_ITEMS | |
Show SYMB_ITEMS | |
ShATermConvertible SYMB_ITEMS | |
GetRange SYMB_ITEMS | |
Pretty SYMB_ITEMS | |
Typeable * SYMB_ITEMS | |
Syntax CSL BASIC_SPEC Symbol SYMB_ITEMS SYMB_MAP_ITEMS | Syntax of CSL logic |
StaticAnalysis CSL BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol | Static Analysis for reduce logic |
Logic CSL () BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol [EXPRESSION] | Instance of Logic for reduce logc |
newtype SYMB
symbol for identifiers
data SYMB_MAP_ITEMS
symbol maps for renamings
Eq SYMB_MAP_ITEMS | |
Data SYMB_MAP_ITEMS | |
Show SYMB_MAP_ITEMS | |
ShATermConvertible SYMB_MAP_ITEMS | |
GetRange SYMB_MAP_ITEMS | |
Pretty SYMB_MAP_ITEMS | |
Typeable * SYMB_MAP_ITEMS | |
Syntax CSL BASIC_SPEC Symbol SYMB_ITEMS SYMB_MAP_ITEMS | Syntax of CSL logic |
StaticAnalysis CSL BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol | Static Analysis for reduce logic |
Logic CSL () BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol [EXPRESSION] | Instance of Logic for reduce logc |
data SYMB_OR_MAP
symbol map or renaming (renaming then denotes the identity renaming)
data OPNAME
Eq OPNAME | |
Data OPNAME | |
Ord OPNAME | |
Show OPNAME | |
ShATermConvertible OPNAME | |
Typeable * OPNAME | |
ExpressionPrinter (Reader OpInfoNameMap) | An |
data OPID
data ConstantName
We differentiate between simple constant names and indexed constant names resulting from the extended parameter elimination.
data OP_ITEM
operator symbol declaration
data VAR_ITEM
variable symbol declaration
data VarDecl
data OpDecl
data EPDecl
data EPVal
Extended Parameter value may be an integer or a reference to an EPDomVal
.
This type is used for the domain specification of EPs (see EPDomain
).
getEPVarRef :: EPVal -> Maybe Token
type Domain = SetOrInterval GroundConstant
type EPDomain = ClosedInterval EPVal
data GroundConstant
cmpFloatToInt :: APFloat -> APInt -> Ordering
data AssDefinition
A constant or function definition
data InstantiatedConstant
data CMD
Ass OpDecl EXPRESSION | |
Cmd String [EXPRESSION] | |
Sequence [CMD] | |
Cond [(EXPRESSION, [CMD])] | |
Repeat EXPRESSION [CMD] |
Eq CMD | |
Data CMD | |
Ord CMD | |
Show CMD | |
ShATermConvertible CMD | |
GetRange CMD | |
Pretty CMD | |
Typeable * CMD | |
Sentences CSL CMD Sign Morphism Symbol | Instance of Sentences for reduce logic |
StaticAnalysis CSL BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol | Static Analysis for reduce logic |
Logic CSL () BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol [EXPRESSION] | Instance of Logic for reduce logc |
class OperatorState a where
OperatorState () | |
OperatorState (AnnoState st) | |
OperatorState a => OperatorState (OpVarState a) | |
OperatorState (OpInfoMap, BindInfoMap) |
data OpInfo
Eq OpInfo | |
Data OpInfo | |
Ord OpInfo | |
Show OpInfo | |
ShATermConvertible OpInfo | |
Typeable * OpInfo | |
ExpressionPrinter (Reader OpInfoNameMap) | An |
OperatorState (OpInfoMap, BindInfoMap) |
data BindInfo
BindInfo | |
|
operatorInfo :: [OpInfo]
Mapping of operator names to arity-OpInfo
-maps (an operator may
behave differently for different arities).
opInfoMap for the predefined operatorInfo
operatorInfoNameMap :: OpInfoNameMap
opInfoNameMap for the predefined operatorInfo
mergeOpArityMap :: Ord a => OpInfoArityMap a -> OpInfoArityMap a -> OpInfoArityMap a
Merges two OpInfoArityMaps together with the first map as default map and the second overwriting the default values
getOpInfoMap :: (OpInfo -> String) -> [OpInfo] -> OpInfoMap
Mapping of operator names to arity-OpInfo
-maps (an operator may
behave differently for different arities).
getOpInfoNameMap :: [OpInfo] -> OpInfoNameMap
Same as operatorInfoMap but with keys of type OPNAME instead of String
getBindInfoMap :: [OpInfo] -> BindInfoMap
a special map for binders which have to be unique for each name (no different arities).
For the given name and arity we lookup an OpInfo
, where arity=-1
means flexible arity. If an operator is registered for the given
string but not for the arity we return: Left True.
:: OpInfoMap | map to be used for lookup |
-> String | operator name |
-> Int | operator arity |
-> Either Bool OpInfo |
For the given name and arity we lookup an OpInfo
, where arity=-1
means flexible arity. If an operator is registered for the given
string but not for the arity we return: Left True.
This function is designed for the lookup of operators in not statically
analyzed terms. For statically analyzed terms use lookupOpInfo.
:: OpInfoNameMap | |
-> OPID | operator name |
-> Int | operator arity |
-> Maybe BindInfo |
For the given name and arity we lookup an BindInfo
, where arity=-1
means flexible arity.
toFraction :: APFloat -> (Integer, Integer)
fromFraction :: Integer -> Integer -> APFloat
type OpInfoNameMap = OpInfoArityMap OPNAME
type BindInfoMap = Map String OpInfo
showOPNAME :: OPNAME -> String
maxPrecedence :: Int