LocalEnv.hs revision fbf80d5a0f83312673b660f28c461943196feb74
55cf6e01272ec475edea32aa9b7923de2d36cb42Christian Maedermodule LocalEnv where
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu Prodescuimport AS_Annotation
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederimport FiniteMap
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederimport List(intersperse)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederimport Maybe(mapMaybe)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maedertype SortId = Id -- non-mixfix, but possibly compound
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata FunKind = Total | Partial deriving (Show, Eq, Ord)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder-- constants have empty argument lists
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata OpType = OpType {opKind :: FunKind, opArgs :: [SortId], opRes :: SortId}
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder deriving (Show, Eq, Ord)
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maedertype PredType = [SortId]
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata SymbType = OpAsItemType OpType
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder | PredType PredType
3b48e17c1da54ee669e70b626d9fbc32ce495b2cChristian Maeder deriving (Show, Eq, Ord)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata Symbol = Symbol {symbId :: Id, symbType :: SymbType}
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder deriving (Show, Eq, Ord)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder-- the list of items which are part of a "sort-gen" (or free type)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maedertype GenItems = [Symbol]
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder-- full function type of a selector (result sort is component sort)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata Component = Component (Maybe Id) OpType [Pos] deriving (Show, Eq)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder-- full function type of constructor (result sort is the data type)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata Alternative = Construct Id OpType [Component] [Pos]
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder | Subsort SortId [Pos]
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder deriving (Show, Eq)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder-- looseness of a datatype
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder-- a datatype may (only) be (sub-)part of a "sort-gen"
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata GenKind = Free | Generated | Loose deriving (Show, Eq)
3b48e17c1da54ee669e70b626d9fbc32ce495b2cChristian Maederdata VarDecl = VarDecl {varId :: Id, varSort :: SortId} deriving (Show, Eq)
3b48e17c1da54ee669e70b626d9fbc32ce495b2cChristian Maeder-- sort defined as predicate subtype or as more or less loose datatype
3b48e17c1da54ee669e70b626d9fbc32ce495b2cChristian Maederdata SortDefn = SubsortDefn VarDecl Formula [Pos]
23a0d43ca980983c7d7aebaa9f03bfe120be7de8Christian Maeder | Datatype [Annoted Alternative] GenKind GenItems [Pos]
3b48e17c1da54ee669e70b626d9fbc32ce495b2cChristian Maeder deriving (Show, Eq)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder-- the sub- and supertypes of a sort
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata SortRels = SortRels { subsorts :: [SortId] -- explicitly given
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder , supersorts :: [SortId]
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder , allsubsrts :: [SortId] -- transitively closed
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder , allsupersrts :: [SortId]
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder } deriving (Show, Eq)
400321fd7a25a1c34eb95855ee86daf722734bd4Mihai Codescudata ItemStart = Key | Comma | Semi | Less deriving (Show, Eq)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata ItemPos = ItemPos String ItemStart [Pos] deriving (Show, Eq)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder-- "filename" plus positions of op, :, * ... *, ->, ",", assoc ...
| GenItems GenItems [Pos] -- generate/free, { , }
flist = map (\x -> (opId x,[(opType x,opId x,(opKind.opType) x == Total)]))