language-oberon-0.3.3: Parser, pretty-printer, and more for the Oberon programming language
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Oberon.TypeChecker

Description

Type checker for Oberon AST. The AST must have its ambiguities previously resolved by Language.Oberon.Resolver.

Synopsis

Documentation

checkModules :: forall l. (Oberon l, Nameable l, Ord (QualIdent l), Show (QualIdent l), Atts (Inherited (Auto TypeCheck)) (Block l l Sem Sem) ~ InhTC l, Atts (Synthesized (Auto TypeCheck)) (Block l l Sem Sem) ~ SynTCMod l, Functor (Auto TypeCheck) (Block l l)) => Environment l -> Map Ident (Placed (Module l l Placed Placed)) -> [Error Ident l] Source #

Check if the given collection of modules is well typed and return all type errors found. The collection is a Map keyed by module name. The first argument's value is typically predefined or predefined2.

data Error m l Source #

Constructors

Error 

Fields

Instances

Instances details
(Show m, Show (QualIdent l)) => Show (Error m l) Source # 
Instance details

Defined in Language.Oberon.TypeChecker

Methods

showsPrec :: Int -> Error m l -> ShowS #

show :: Error m l -> String #

showList :: [Error m l] -> ShowS #

(Eq m, Eq (QualIdent l)) => Eq (Error m l) Source # 
Instance details

Defined in Language.Oberon.TypeChecker

Methods

(==) :: Error m l -> Error m l -> Bool #

(/=) :: Error m l -> Error m l -> Bool #

data ErrorType l Source #

Constructors

ArgumentCountMismatch Int Int 
ExtraDimensionalIndex Int Int 
IncomparableTypes (Type l) (Type l) 
IncompatibleTypes (Type l) (Type l) 
TooSmallArrayType Int Int 
OpenArrayVariable 
NonArrayType (Type l) 
NonBooleanType (Type l) 
NonFunctionType (Type l) 
NonIntegerType (Type l) 
NonNumericType (Type l) 
NonPointerType (Type l) 
NonProcedureType (Type l) 
NonRecordType (Type l) 
TypeMismatch (Type l) (Type l) 
UnequalTypes (Type l) (Type l) 
UnrealType (Type l) 
UnknownName (QualIdent l) 
UnknownField Ident (Type l) 

Instances

Instances details
Show (QualIdent l) => Show (ErrorType l) Source # 
Instance details

Defined in Language.Oberon.TypeChecker

Eq (QualIdent l) => Eq (ErrorType l) Source # 
Instance details

Defined in Language.Oberon.TypeChecker

Methods

(==) :: ErrorType l -> ErrorType l -> Bool #

(/=) :: ErrorType l -> ErrorType l -> Bool #

predefined :: (Wirthy l, Ord (QualIdent l)) => Environment l Source #

The set of Predefined types and procedures defined in the Oberon Language Report.

predefined2 :: (Wirthy l, Ord (QualIdent l)) => Environment l Source #

The set of Predefined types and procedures defined in the Oberon-2 Language Report.

Orphan instances

Apply (Module l l f' :: (Type -> Type) -> Type) Source # 
Instance details

Methods

(<*>) :: forall (p :: k -> Type) (q :: k -> Type). Module l l f' (p ~> q) -> Module l l f' p -> Module l l f' q #

liftA2 :: (forall (a :: k). p a -> q a -> r a) -> Module l l f' p -> Module l l f' q -> Module l l f' r #

liftA3 :: (forall (a :: k). p a -> q a -> r a -> s a) -> Module l l f' p -> Module l l f' q -> Module l l f' r -> Module l l f' s #