Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- module Language.Fortran.Vars.Types.SymbolTable
- type TypeOf a = Expression a -> Either TypeError Type
- data TypeError
- type ProgramStructureTables = Map ProgramUnitName StructureTable
- type ProgramFileModel = Map ProgramUnitName ProgramUnitModel
- type ProgramUnitModel = (SymbolTable, StorageTable)
- type StorageTable = Map MemoryBlockName MemoryBlock
- data StructureTableEntry
- type Structure = [StructureTableEntry]
- type StructureTable = Map String Structure
- data MemoryBlock = MemoryBlock {
- blockSize :: Maybe Int
- storageClass :: StorageClass
- variables :: [Name]
- data StorageClass
- = Static
- | Automatic
- | Constant
- | Common
- | Unspecified
- typeError :: SrcSpan -> String -> TypeError
- dimensionsToTuples' :: Dimensions -> [(Int, Int)]
- getStaticArrayBounds :: Traversable t => Dims t (Maybe a) -> Maybe (Dims t a)
- type Type = SemType
- data SemType
- data Dim a = Dim {}
- data Dims (t :: Type -> TYPE LiftedRep) a
- = DimsExplicitShape (t (Dim a))
- | DimsAssumedSize (Maybe (t (Dim a))) a
- | DimsAssumedShape (t a)
- type Dimensions = Dims NonEmpty (Maybe Int)
- dimensionsToTuples :: Dimensions -> Maybe [(Int, Int)]
- dimsTraverse :: forall (t :: Type -> Type) f a. (Traversable t, Applicative f) => Dims t (f a) -> f (Dims t a)
- dimsLength :: forall (t :: TYPE LiftedRep -> Type) a. Foldable t => Dims t a -> Int
- data CharacterLen
- type Kind = Int
- data ExpVal
Documentation
Instances
type ProgramStructureTables = Map ProgramUnitName StructureTable Source #
Mapping from name of a program unit to relevant structure table
type ProgramFileModel = Map ProgramUnitName ProgramUnitModel Source #
Mapping from the name of a ProgramUnit
to
its ProgramUnitModel
type ProgramUnitModel = (SymbolTable, StorageTable) Source #
The model to represent an individual ProgramUnit
type StorageTable = Map MemoryBlockName MemoryBlock Source #
Mapping from the name of a memory block to the information about it
data StructureTableEntry Source #
Data structurue for a single field of a structure
Instances
type Structure = [StructureTableEntry] Source #
type StructureTable = Map String Structure Source #
Map from a structure name to its internal structure, specifying members and their corresponding type. This can then be used to check the type of a data reference expression.
data MemoryBlock Source #
Structure to hold information about the named blocks of memory in the program
MemoryBlock | |
|
Instances
data StorageClass Source #
The declared lifetimes of the variables in memory
Instances
dimensionsToTuples' :: Dimensions -> [(Int, Int)] Source #
getStaticArrayBounds :: Traversable t => Dims t (Maybe a) -> Maybe (Dims t a) Source #
Attempt to turn a list of evaluated array bounds which may include unknown
bounds, into a list of known bounds. Any unknown bounds will result in a
Nothing
.
Semantic type assigned to variables.
BaseType
stores the "type tag" given in syntax. SemType
s add metadata
(kind and length), and resolve some "simple" types to a core type with a
preset kind (e.g. `DOUBLE PRECISION` -> `REAL(8)`).
Fortran 90 (and beyond) features may not be well supported.
TInteger Kind | |
TReal Kind | |
TComplex Kind | |
TLogical Kind | |
TByte Kind | |
TCharacter CharacterLen Kind | |
TArray SemType Dimensions | A Fortran array type is represented by a type and a set of dimensions. |
TCustom String | Constructor to use for F77 structures, F90 DDTs |
Instances
A single array dimension with bounds of type a
.
is a static, known-size dimension.Num
a =>Dim
a
is a dimension with unevaluated bounds expressions. Note that these bounds may be constant expressions, or refer to dummy variables, or be invalid.Dim
(Expression
()
)
is a dimension where some bounds are known, and others are not. This may be useful to record some information about dynamic explicit-shape arrays.Num
a =>Dim
(Maybe
a)
Instances
Foldable Dim | |
Defined in Language.Fortran.Common.Array fold :: Monoid m => Dim m -> m Source # foldMap :: Monoid m => (a -> m) -> Dim a -> m Source # foldMap' :: Monoid m => (a -> m) -> Dim a -> m Source # foldr :: (a -> b -> b) -> b -> Dim a -> b Source # foldr' :: (a -> b -> b) -> b -> Dim a -> b Source # foldl :: (b -> a -> b) -> b -> Dim a -> b Source # foldl' :: (b -> a -> b) -> b -> Dim a -> b Source # foldr1 :: (a -> a -> a) -> Dim a -> a Source # foldl1 :: (a -> a -> a) -> Dim a -> a Source # toList :: Dim a -> [a] Source # null :: Dim a -> Bool Source # length :: Dim a -> Int Source # elem :: Eq a => a -> Dim a -> Bool Source # maximum :: Ord a => Dim a -> a Source # minimum :: Ord a => Dim a -> a Source # | |
Traversable Dim | |
Functor Dim | |
Out a => Out (Dim a) | Fortran syntax uses |
FromJSON (Dim (Maybe Int)) Source # | |
Data a => Data (Dim a) | |
Defined in Language.Fortran.Common.Array gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Dim a -> c (Dim a) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Dim a) Source # toConstr :: Dim a -> Constr Source # dataTypeOf :: Dim a -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Dim a)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Dim a)) Source # gmapT :: (forall b. Data b => b -> b) -> Dim a -> Dim a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Dim a -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Dim a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Dim a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Dim a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Dim a -> m (Dim a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Dim a -> m (Dim a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Dim a -> m (Dim a) Source # | |
Generic (Dim a) | |
Show a => Show (Dim a) | |
Binary a => Binary (Dim a) | |
NFData a => NFData (Dim a) | |
Defined in Language.Fortran.Common.Array | |
Out (Dim a) => Pretty (Dim a) | |
Defined in Language.Fortran.Common.Array | |
Eq a => Eq (Dim a) | |
Ord a => Ord (Dim a) | |
Defined in Language.Fortran.Common.Array | |
type Rep (Dim a) | |
Defined in Language.Fortran.Common.Array type Rep (Dim a) = D1 ('MetaData "Dim" "Language.Fortran.Common.Array" "fortran-src-0.15.0-c374304f6a26b2e6e1e1e09dd9acee640e5193a35a08d212d6794a128ceb6d72" 'False) (C1 ('MetaCons "Dim" 'PrefixI 'True) (S1 ('MetaSel ('Just "dimLower") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "dimUpper") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) |
data Dims (t :: Type -> TYPE LiftedRep) a Source #
Fortran array dimensions, defined by a list of Dim
s storing lower and
upper bounds.
You select the list type t
(which should be Functor
, Foldable
and
Traversable
) and the bound type a
(e.g. Int
).
Using a non-empty list type such as NonEmpty
will
disallow representing zero-dimension arrays, providing extra soundness.
Note the following excerpt from the F2018 standard (8.5.8.2 Explicit-shape array):
If the upper bound is less than the lower bound, the range is empty, the extent in that dimension is zero, and the array is of zero size.
Note that the Foldable
instance does not provide "dimension-like" access to
this type. That is,
will _not_ tell you how many
dimensions length
(a :: Dims
t a)a
represents. Use dimsLength
for that.
DimsExplicitShape | Explicit-shape array. All dimensions are known. |
| |
DimsAssumedSize | Assumed-size array. The final dimension has no upper bound (it is obtained from its effective argument). Earlier dimensions may be defined like explicit-shape arrays. |
DimsAssumedShape | Assumed-shape array. Shape is taken from effective argument. We store the lower bound for each dimension, and thus also the rank (via list length). |
|
Instances
FromJSON Dimensions Source # | |
Defined in Language.Fortran.Vars.Orphans parseJSON :: Value -> Parser Dimensions Source # parseJSONList :: Value -> Parser [Dimensions] Source # | |
Foldable t => Foldable (Dims t) | |
Defined in Language.Fortran.Common.Array fold :: Monoid m => Dims t m -> m Source # foldMap :: Monoid m => (a -> m) -> Dims t a -> m Source # foldMap' :: Monoid m => (a -> m) -> Dims t a -> m Source # foldr :: (a -> b -> b) -> b -> Dims t a -> b Source # foldr' :: (a -> b -> b) -> b -> Dims t a -> b Source # foldl :: (b -> a -> b) -> b -> Dims t a -> b Source # foldl' :: (b -> a -> b) -> b -> Dims t a -> b Source # foldr1 :: (a -> a -> a) -> Dims t a -> a Source # foldl1 :: (a -> a -> a) -> Dims t a -> a Source # toList :: Dims t a -> [a] Source # null :: Dims t a -> Bool Source # length :: Dims t a -> Int Source # elem :: Eq a => a -> Dims t a -> Bool Source # maximum :: Ord a => Dims t a -> a Source # minimum :: Ord a => Dims t a -> a Source # | |
Traversable t => Traversable (Dims t) | |
Defined in Language.Fortran.Common.Array | |
Functor t => Functor (Dims t) | |
(Foldable t, Functor t, Out (Dim a), Out a) => Out (Dims t a) | |
(Data a, Data (t a), Data (t (Dim a)), Typeable t) => Data (Dims t a) | |
Defined in Language.Fortran.Common.Array gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Dims t a -> c (Dims t a) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Dims t a) Source # toConstr :: Dims t a -> Constr Source # dataTypeOf :: Dims t a -> DataType Source # dataCast1 :: Typeable t0 => (forall d. Data d => c (t0 d)) -> Maybe (c (Dims t a)) Source # dataCast2 :: Typeable t0 => (forall d e. (Data d, Data e) => c (t0 d e)) -> Maybe (c (Dims t a)) Source # gmapT :: (forall b. Data b => b -> b) -> Dims t a -> Dims t a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Dims t a -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Dims t a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Dims t a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Dims t a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Dims t a -> m (Dims t a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Dims t a -> m (Dims t a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Dims t a -> m (Dims t a) Source # | |
Generic (Dims t a) | |
(Show a, Show (t a), Show (t (Dim a))) => Show (Dims t a) | |
(Binary a, Binary (t a), Binary (t (Dim a))) => Binary (Dims t a) | |
(NFData a, NFData (t a), NFData (t (Dim a))) => NFData (Dims t a) | |
Defined in Language.Fortran.Common.Array | |
Out (Dims t a) => Pretty (Dims t a) | |
Defined in Language.Fortran.Common.Array | |
(Eq a, Eq (t a), Eq (t (Dim a))) => Eq (Dims t a) | |
(Ord a, Ord (t a), Ord (t (Dim a))) => Ord (Dims t a) | This instance is purely for convenience. No definition of ordering is provided, and the implementation may change at any time. |
Defined in Language.Fortran.Common.Array | |
type Rep (Dims t a) | |
Defined in Language.Fortran.Common.Array type Rep (Dims t a) = D1 ('MetaData "Dims" "Language.Fortran.Common.Array" "fortran-src-0.15.0-c374304f6a26b2e6e1e1e09dd9acee640e5193a35a08d212d6794a128ceb6d72" 'False) (C1 ('MetaCons "DimsExplicitShape" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (t (Dim a)))) :+: (C1 ('MetaCons "DimsAssumedSize" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (t (Dim a)))) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "DimsAssumedShape" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (t a))))) |
dimensionsToTuples :: Dimensions -> Maybe [(Int, Int)] Source #
Convert Dimensions
data type to its previous type synonym
(Maybe [(Int, Int)])
.
Drops all information for array dimensions that aren't fully static/known.
dimsTraverse :: forall (t :: Type -> Type) f a. (Traversable t, Applicative f) => Dims t (f a) -> f (Dims t a) Source #
dimsLength :: forall (t :: TYPE LiftedRep -> Type) a. Foldable t => Dims t a -> Int Source #
How many dimensions does the given Dims
represent?
data CharacterLen Source #
CharLenStar | specified with a * |
CharLenColon | specified with a : (Fortran2003) FIXME, possibly, with a more robust const-exp: |
CharLenExp | specified with a non-trivial expression |
CharLenInt Int | specified with a constant integer |
Instances
The evaluated value of a FORTRAN expression.