Hets - the Heterogeneous Tool Set

Copyright(c) Dominik Dietrich, Ewaryst Schulz, DFKI Bremen 2010
LicenseGPLv2 or higher, see LICENSE.txt
MaintainerEwaryst.Schulz@dfki.de
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred

CSL.AS_BASIC_CSL

Description

This module contains the abstract syntax types for EnCL as well as the predefined operator configuration.

Synopsis

Documentation

data BASIC_ITEM

basic items: an operator, extended parameter or variable declaration or an axiom

newtype SYMB

symbol for identifiers

Constructors

Symb_id Token 

data SYMB_OR_MAP

symbol map or renaming (renaming then denotes the identity renaming)

Constructors

Symb SYMB 
Symb_map SYMB SYMB Range 

data ConstantName

We differentiate between simple constant names and indexed constant names resulting from the extended parameter elimination.

data OP_ITEM

operator symbol declaration

Constructors

Op_item [Token] Range 

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).

Constructors

EPVal APInt 
EPConstRef Token 

class OperatorState a where

Minimal complete definition

lookupOperator, lookupBinder

Methods

addVar :: a -> String -> a

isVar :: a -> String -> Bool

lookupOperator

Arguments

:: a 
-> String

operator name

-> Int

operator arity

-> Either Bool OpInfo 

lookupBinder

Arguments

:: a 
-> String

binder name

-> Maybe OpInfo 

data OpInfo

Constructors

OpInfo 

Fields

prec :: Int

precedence between 0 and maxPrecedence

infx :: Bool

True = infix

arity :: Int

the operator arity

foldNAry :: Bool

True = fold nary-applications during construction into binary ones

opname :: OPNAME

The actual operator name

bind :: Maybe BindInfo

More info for binders

data BindInfo

Constructors

BindInfo 

Fields

bindingVarPos :: [Int]

argument positions of binding variables

boundBodyPos :: [Int]

argument positions of bound terms

operatorInfo :: [OpInfo]

Mapping of operator names to arity-OpInfo-maps (an operator may behave differently for different arities).

operatorInfoMap :: OpInfoMap

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).

lookupOpInfo

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

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.

lookupBindInfo

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.

type APInt = Integer

type OpInfoMap = OpInfoArityMap String

type OpInfoNameMap = OpInfoArityMap OPNAME