Safe Haskell | Safe-Inferred |
---|
Intermediate representation (IR) of a Clafer model
- type UID = String
- type CName = String
- data Ir
- data IType
- data IModule = IModule {}
- data IClafer = IClafer {}
- data IElement
- = IEClafer IClafer
- | IEConstraint { }
- | IEGoal {
- isMaximize :: Bool
- cpexp :: PExp
- data ISuper = ISuper {
- isOverlapping :: Bool
- supers :: [PExp]
- data IGCard = IGCard {}
- type Interval = (Integer, Integer)
- data PExp = PExp {}
- data IExp
- data IDecl = IDecl {}
- data IQuant
- type LineNo = Integer
- type ColNo = Integer
- mapIR :: (Ir -> Ir) -> IModule -> IModule
- foldMapIR :: Monoid m => (Ir -> m) -> IModule -> m
- foldIR :: (Ir -> a -> a) -> a -> IModule -> a
- iMap :: (Ir -> Ir) -> Ir -> Ir
- iFoldMap :: Monoid m => (Ir -> m) -> Ir -> m
- iFold :: (Ir -> a -> a) -> a -> Ir -> a
- unWrapIModule :: Ir -> IModule
- unWrapIElement :: Ir -> IElement
- unWrapIType :: Ir -> IType
- unWrapIClafer :: Ir -> IClafer
- unWrapIExp :: Ir -> IExp
- unWrapPExp :: Ir -> PExp
- unWrapISuper :: Ir -> ISuper
- unWrapIQuant :: Ir -> IQuant
- unWrapIDecl :: Ir -> IDecl
- unWrapIGCard :: Ir -> IGCard
Documentation
A supertype of all IR types
each file contains exactly one mode. A module is a list of declarations
Clafer has a list of fields that specify its properties. Some fields, marked as (o) are for generating optimized code
IClafer | |
|
Clafer's subelement is either a clafer, a constraint, or a goal (objective) This is a wrapper type needed to have polymorphic lists of elements
IEClafer IClafer | |
IEConstraint | |
IEGoal | Goal (optimization objective) |
|
A list of superclafers. -> overlaping unique (set) ->> overlapping non-unique (bag) : non overlapping (disjoint)
ISuper | |
|
Group cardinality is specified as an interval. It may also be given by a keyword. xor 1..1 isKeyword = True 1..1 1..1 isKeyword = False
This is expression container (parent).
It has meta information about an actual expression exp
IDeclPExp | quantified expression with declarations e.g., [ all x1; x2 : X | x1.ref != x2.ref ] |
IFunExp | expression with a unary function, e.g., -1 binary function, e.g., 2 + 3 ternary function, e.g., if x then 4 else 5 |
IInt Integer | integer number |
IDouble Double | real number |
IStr String | string |
IClaferId | a reference to a clafer name |
For IFunExp standard set of operators includes: 1. Unary operators: ! - not (logical) # - set counting operator - - negation (arithmetic) max - maximum (created for goals) min - minimum (created for goals) 2. Binary operators: <=> - equivalence => - implication || - disjunction xor - exclusive or && - conjunction < - less than > - greater than = - equality <= - less than or equal >= - greater than or equal != - inequality in - belonging to a set/being a subset nin - not belonging to a set/not being a subset + - addition/string concatenation - - substraction * - multiplication / - division ++ - set union -- - set difference & - set intersection <: - domain restriction :> - range restriction . - relational join 3. Ternary operators ifthenelse -- if then else
Local declaration disj x1; x2 : X ++ Y y1 : Y
quantifier
unWrapIModule :: Ir -> IModuleSource
unWrapIElement :: Ir -> IElementSource
unWrapIType :: Ir -> ITypeSource
unWrapIClafer :: Ir -> IClaferSource
unWrapIExp :: Ir -> IExpSource
unWrapPExp :: Ir -> PExpSource
unWrapISuper :: Ir -> ISuperSource
unWrapIQuant :: Ir -> IQuantSource
unWrapIDecl :: Ir -> IDeclSource
unWrapIGCard :: Ir -> IGCardSource