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 |
CSL.AS_BASIC_CSL
Description
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
- = SimpleConstant String
- | ElimConstant String Int
- 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
- = ConstDef EXPRESSION
- | FunDef [String] EXPRESSION
- 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 Source #
Datatype for expressions
Constructors
Var Token | |
Op OPID [EXTPARAM] [EXPRESSION] Range | |
List [EXPRESSION] Range | |
Interval Double Double Range | |
Int APInt Range | |
Rat APFloat Range |
Instances
Eq EXPRESSION Source # | |
Data EXPRESSION Source # | |
Ord EXPRESSION Source # | |
Show EXPRESSION Source # | |
Logic CSL () BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol [EXPRESSION] Source # | Instance of Logic for reduce logc |
Extended Parameter Datatype
data BASIC_ITEM Source #
basic items: an operator, extended parameter or variable declaration or an axiom
Constructors
Op_decl OP_ITEM | |
EP_decl [(Token, EPDomain)] | |
EP_domdecl [(Token, APInt)] | |
EP_defval [(Token, APInt)] | |
Var_decls [VAR_ITEM] | |
Axiom_item (Annoted CMD) |
Instances
Data BASIC_ITEM Source # | |
Show BASIC_ITEM Source # | |
newtype BASIC_SPEC Source #
Constructors
Basic_spec [Annoted BASIC_ITEM] |
Instances
Data BASIC_SPEC Source # | |
Show BASIC_SPEC Source # | |
Syntax CSL BASIC_SPEC Symbol SYMB_ITEMS SYMB_MAP_ITEMS Source # | Syntax of CSL logic |
StaticAnalysis CSL BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol Source # | Static Analysis for reduce logic |
Logic CSL () BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol [EXPRESSION] Source # | Instance of Logic for reduce logc |
data SYMB_ITEMS Source #
symbol lists for hiding
Constructors
Symb_items [SYMB] Range |
Instances
Eq SYMB_ITEMS Source # | |
Data SYMB_ITEMS Source # | |
Show SYMB_ITEMS Source # | |
Syntax CSL BASIC_SPEC Symbol SYMB_ITEMS SYMB_MAP_ITEMS Source # | Syntax of CSL logic |
StaticAnalysis CSL BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol Source # | Static Analysis for reduce logic |
Logic CSL () BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol [EXPRESSION] Source # | Instance of Logic for reduce logc |
symbol for identifiers
data SYMB_MAP_ITEMS Source #
symbol maps for renamings
Constructors
Symb_map_items [SYMB_OR_MAP] Range |
Instances
Eq SYMB_MAP_ITEMS Source # | |
Data SYMB_MAP_ITEMS Source # | |
Show SYMB_MAP_ITEMS Source # | |
Syntax CSL BASIC_SPEC Symbol SYMB_ITEMS SYMB_MAP_ITEMS Source # | Syntax of CSL logic |
StaticAnalysis CSL BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol Source # | Static Analysis for reduce logic |
Logic CSL () BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol [EXPRESSION] Source # | Instance of Logic for reduce logc |
data SYMB_OR_MAP Source #
symbol map or renaming (renaming then denotes the identity renaming)
Instances
Eq SYMB_OR_MAP Source # | |
Data SYMB_OR_MAP Source # | |
Show SYMB_OR_MAP Source # | |
Constructors
Instances
Eq OPNAME Source # | |
Data OPNAME Source # | |
Ord OPNAME Source # | |
Show OPNAME Source # | |
ExpressionPrinter (Reader OpInfoNameMap) Source # | An |
Constructors
OpId OPNAME | |
OpUser ConstantName |
data ConstantName Source #
We differentiate between simple constant names and indexed constant names resulting from the extended parameter elimination.
Constructors
SimpleConstant String | |
ElimConstant String Int |
Instances
Eq ConstantName Source # | |
Data ConstantName Source # | |
Ord ConstantName Source # | |
Show ConstantName Source # | |
operator symbol declaration
variable symbol declaration
Constructors
OpDecl ConstantName [EXTPARAM] [VarDecl] Range |
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
).
Constructors
EPVal APInt | |
EPConstRef Token |
getEPVarRef :: EPVal -> Maybe Token Source #
type Domain = SetOrInterval GroundConstant Source #
type EPDomain = ClosedInterval EPVal Source #
data GroundConstant Source #
Instances
Eq GroundConstant Source # | |
Data GroundConstant Source # | |
Ord GroundConstant Source # | |
Show GroundConstant Source # | |
Continuous GroundConstant Source # | |
cmpFloatToInt :: APFloat -> APInt -> Ordering Source #
data AssDefinition Source #
A constant or function definition
Constructors
ConstDef EXPRESSION | |
FunDef [String] EXPRESSION |
Instances
Eq AssDefinition Source # | |
Data AssDefinition Source # | |
Ord AssDefinition Source # | |
Show AssDefinition Source # | |
data InstantiatedConstant Source #
Constructors
InstantiatedConstant | |
Fields
|
Instances
Eq InstantiatedConstant Source # | |
Data InstantiatedConstant Source # | |
Ord InstantiatedConstant Source # | |
Show InstantiatedConstant Source # | |
Constructors
Ass OpDecl EXPRESSION | |
Cmd String [EXPRESSION] | |
Sequence [CMD] | |
Cond [(EXPRESSION, [CMD])] | |
Repeat EXPRESSION [CMD] |
Instances
Eq CMD Source # | |
Data CMD Source # | |
Ord CMD Source # | |
Show CMD Source # | |
Sentences CSL CMD Sign Morphism Symbol Source # | Instance of Sentences for reduce logic |
StaticAnalysis CSL BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol Source # | Static Analysis for reduce logic |
Logic CSL () BASIC_SPEC CMD SYMB_ITEMS SYMB_MAP_ITEMS Sign Morphism Symbol Symbol [EXPRESSION] Source # | Instance of Logic for reduce logc |
class OperatorState a where Source #
Minimal complete definition
Methods
addVar :: a -> String -> a Source #
isVar :: a -> String -> Bool Source #
lookupOperator :: a -> String -> Int -> Either Bool OpInfo Source #
lookupBinder :: a -> String -> Maybe OpInfo Source #
Instances
OperatorState () Source # | |
OperatorState a => OperatorState (OpVarState a) Source # | |
OperatorState (OpInfoMap, BindInfoMap) Source # | |
Constructors
OpInfo | |
Instances
Eq OpInfo Source # | |
Data OpInfo Source # | |
Ord OpInfo Source # | |
Show OpInfo Source # | |
ExpressionPrinter (Reader OpInfoNameMap) Source # | An |
OperatorState (OpInfoMap, BindInfoMap) Source # | |
Constructors
BindInfo | |
Fields
|
operatorInfo :: [OpInfo] Source #
Mapping of operator names to arity-OpInfo
-maps (an operator may
behave differently for different arities).
operatorInfoMap :: OpInfoMap Source #
opInfoMap for the predefined operatorInfo
operatorInfoNameMap :: OpInfoNameMap Source #
opInfoNameMap for the predefined operatorInfo
mergeOpArityMap :: Ord a => OpInfoArityMap a -> OpInfoArityMap a -> OpInfoArityMap a Source #
Merges two OpInfoArityMaps together with the first map as default map and the second overwriting the default values
getOpInfoMap :: (OpInfo -> String) -> [OpInfo] -> OpInfoMap Source #
Mapping of operator names to arity-OpInfo
-maps (an operator may
behave differently for different arities).
getOpInfoNameMap :: [OpInfo] -> OpInfoNameMap Source #
Same as operatorInfoMap but with keys of type OPNAME instead of String
getBindInfoMap :: [OpInfo] -> BindInfoMap Source #
a special map for binders which have to be unique for each name (no different arities).
Arguments
:: OpInfoNameMap | |
-> OPID | operator id |
-> 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.
lookupOpInfoForParsing Source #
Arguments
:: 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.
Arguments
:: 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) Source #
fromFraction :: Integer -> Integer -> APFloat Source #
type OpInfoNameMap = OpInfoArityMap OPNAME Source #
type BindInfoMap = Map String OpInfo Source #
showOPNAME :: OPNAME -> String Source #
maxPrecedence :: Int Source #