Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Finally Tagless Abstract Syntax Tree definitions for the programming language Oberon
Synopsis
- class Wirthy l where
- type Module l = (m :: * -> (* -> *) -> (* -> *) -> *) | m -> l
- type Declaration l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l
- type Type l = (t :: * -> (* -> *) -> (* -> *) -> *) | t -> l
- type Statement l = (s :: * -> (* -> *) -> (* -> *) -> *) | s -> l
- type Expression l = (e :: * -> (* -> *) -> (* -> *) -> *) | e -> l
- type Designator l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l
- type Value l = (v :: * -> (* -> *) -> (* -> *) -> *) | v -> l
- type FieldList l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l
- type ProcedureHeading l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l
- type FormalParameters l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l
- type FPSection l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l
- type Block l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l
- type StatementSequence l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l
- type Case l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l
- type CaseLabels l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l
- type ConditionalBranch l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l
- type Element l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l
- type Import l = x | x -> l
- type IdentDef l = x | x -> l
- type QualIdent l = x | x -> l
- constantDeclaration :: IdentDef l' -> f (ConstExpression l' l' f' f') -> Declaration l l' f' f
- typeDeclaration :: IdentDef l' -> f (Type l' l' f' f') -> Declaration l l' f' f
- variableDeclaration :: IdentList l' -> f (Type l' l' f' f') -> Declaration l l' f' f
- procedureDeclaration :: f (ProcedureHeading l' l' f' f') -> f (Block l' l' f' f') -> Declaration l l' f' f
- formalParameters :: [f (FPSection l' l' f' f')] -> Maybe (ReturnType l') -> FormalParameters l l' f' f
- fpSection :: Bool -> [Ident] -> f (Type l' l' f' f') -> FPSection l l' f' f
- block :: [f (Declaration l' l' f' f')] -> Maybe (f (StatementSequence l' l' f' f')) -> Block l l' f' f
- fieldList :: NonEmpty (IdentDef l') -> f (Type l' l' f' f') -> FieldList l l' f' f
- pointerType :: f (Type l' l' f' f') -> Type l l' f' f
- procedureType :: Maybe (f (FormalParameters l' l' f' f')) -> Type l l' f' f
- typeReference :: QualIdent l' -> Type l l' f' f
- assignment :: f (Designator l' l' f' f') -> f (Expression l' l' f' f') -> Statement l l' f' f
- caseStatement :: f (Expression l' l' f' f') -> [f (Case l' l' f' f')] -> Maybe (f (StatementSequence l' l' f' f')) -> Statement l l' f' f
- emptyStatement :: Statement l l' f' f
- exitStatement :: Statement l l' f' f
- ifStatement :: NonEmpty (f (ConditionalBranch l' l' f' f')) -> Maybe (f (StatementSequence l' l' f' f')) -> Statement l l' f' f
- loopStatement :: f (StatementSequence l' l' f' f') -> Statement l l' f' f
- procedureCall :: f (Designator l' l' f' f') -> Maybe [f (Expression l' l' f' f')] -> Statement l l' f' f
- repeatStatement :: f (StatementSequence l' l' f' f') -> f (Expression l' l' f' f') -> Statement l l' f' f
- returnStatement :: Maybe (f (Expression l' l' f' f')) -> Statement l l' f' f
- whileStatement :: f (Expression l' l' f' f') -> f (StatementSequence l' l' f' f') -> Statement l l' f' f
- conditionalBranch :: f (Expression l' l' f' f') -> f (StatementSequence l' l' f' f') -> ConditionalBranch l l' f' f
- caseAlternative :: NonEmpty (f (CaseLabels l' l' f' f')) -> f (StatementSequence l' l' f' f') -> Case l l' f' f
- singleLabel :: f (ConstExpression l' l' f' f') -> CaseLabels l l' f' f
- labelRange :: f (ConstExpression l' l' f' f') -> f (ConstExpression l' l' f' f') -> CaseLabels l l' f' f
- statementSequence :: [f (Statement l' l' f' f')] -> StatementSequence l l' f' f
- add, subtract :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f
- and, or :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f
- divide, integerDivide, modulo, multiply :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f
- functionCall :: f (Designator l' l' f' f') -> [f (Expression l' l' f' f')] -> Expression l l' f' f
- literal :: f (Value l' l' f' f') -> Expression l l' f' f
- negative, positive :: f (Expression l' l' f' f') -> Expression l l' f' f
- not :: f (Expression l' l' f' f') -> Expression l l' f' f
- read :: f (Designator l' l' f' f') -> Expression l l' f' f
- relation :: RelOp -> f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f
- element :: f (Expression l' l' f' f') -> Element l l' f' f
- range :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Element l l' f' f
- integer :: Integer -> Value l l' f' f
- nil, false, true :: Value l l' f' f
- real :: Double -> Value l l' f' f
- string :: Text -> Value l l' f' f
- charCode :: Int -> Value l l' f' f
- builtin :: Text -> Value l l' f' f
- variable :: QualIdent l' -> Designator l l' f' f
- field :: f (Designator l' l' f' f') -> Ident -> Designator l l' f' f
- index :: f (Designator l' l' f' f') -> NonEmpty (f (Expression l' l' f' f')) -> Designator l l' f' f
- dereference :: f (Designator l' l' f' f') -> Designator l l' f' f
- identDef :: Ident -> IdentDef l
- nonQualIdent :: Ident -> QualIdent l
- class Wirthy l => CoWirthy l where
- type TargetClass l :: * -> Constraint
- coDeclaration :: TargetClass l l' => Declaration l l'' f' f -> Declaration l' l'' f' f
- coType :: TargetClass l l' => Type l l'' f' f -> Type l' l'' f' f
- coStatement :: TargetClass l l' => Statement l l'' f' f -> Statement l' l'' f' f
- coExpression :: TargetClass l l' => Expression l l'' f' f -> Expression l' l'' f' f
- coDesignator :: TargetClass l l' => Designator l l'' f' f -> Designator l' l'' f' f
- coValue :: TargetClass l l' => Value l l'' f' f -> Value l' l'' f' f
- class Wirthy l => Oberon l where
- type WithAlternative l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l
- moduleUnit :: Ident -> [Import l] -> f (Block l' l' f' f') -> Module l l' f' f
- moduleImport :: Maybe Ident -> Ident -> Import l
- qualIdent :: Ident -> Ident -> QualIdent l
- getQualIdentNames :: QualIdent l -> Maybe (Ident, Ident)
- exported :: Ident -> IdentDef l
- forwardDeclaration :: IdentDef l' -> Maybe (f (FormalParameters l' l' f' f')) -> Declaration l l' f' f
- procedureHeading :: Bool -> IdentDef l' -> Maybe (f (FormalParameters l' l' f' f')) -> ProcedureHeading l l' f' f
- arrayType :: [f (ConstExpression l' l' f' f')] -> f (Type l' l' f' f') -> Type l l' f' f
- recordType :: Maybe (BaseType l') -> [f (FieldList l' l' f' f')] -> Type l l' f' f
- withStatement :: f (WithAlternative l' l' f' f') -> Statement l l' f' f
- withAlternative :: QualIdent l' -> QualIdent l' -> f (StatementSequence l' l' f' f') -> WithAlternative l l' f' f
- is :: f (Expression l' l' f' f') -> QualIdent l' -> Expression l l' f' f
- set :: [f (Element l' l' f' f')] -> Expression l l' f' f
- typeGuard :: f (Designator l' l' f' f') -> QualIdent l' -> Designator l l' f' f
- class Oberon l => Oberon2 l where
- readOnly :: Ident -> IdentDef l
- typeBoundHeading :: Bool -> Ident -> Ident -> Bool -> IdentDef l' -> Maybe (f (FormalParameters l' l' f' f')) -> ProcedureHeading l l' f' f
- forStatement :: Ident -> f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Maybe (f (Expression l' l' f' f')) -> f (StatementSequence l' l' f' f') -> Statement l l' f' f
- variantWithStatement :: NonEmpty (f (WithAlternative l' l' f' f')) -> Maybe (f (StatementSequence l' l' f' f')) -> Statement l l' f' f
- class Wirthy l => Nameable l where
- getProcedureName :: Nameable l' => ProcedureHeading l l' f' f -> Ident
- getIdentDefName :: IdentDef l -> Ident
- getNonQualIdentName :: QualIdent l -> Maybe Ident
- type Ident = Text
- type IdentList l = NonEmpty (IdentDef l)
- type BaseType l = QualIdent l
- type ReturnType l = QualIdent l
- type ConstExpression l = Expression l
- data RelOp
- = Equal
- | Unequal
- | Less
- | LessOrEqual
- | Greater
- | GreaterOrEqual
- | In
- data WirthySubsetOf l = WirthySubsetOf l
- newtype Maybe3 f a b c = Maybe3 (Maybe (f a b c))
- just3 :: forall k1 k2 k3 f (a :: k1) (b :: k2) (c :: k3). f a b c -> Maybe3 f a b c
- nothing3 :: forall k1 k2 k3 (f :: k1 -> k2 -> k3 -> Type) (a :: k1) (b :: k2) (c :: k3). Maybe3 f a b c
- maybe3 :: forall k1 k2 k3 b1 f (a :: k1) (b2 :: k2) (c :: k3). b1 -> (f a b2 c -> b1) -> Maybe3 f a b2 c -> b1
Language classes
The finally-tagless associated types and methods relevant to all programming languages designed by Niklaus Wirth. Every non-leaf node type has four type variables:
- type variable
l
represents the language of the constructs built by the methods, l'
is the language of the child node constructs,f'
wraps all descendant nodes, exceptf
wraps all direct children of the node.
type Module l = (m :: * -> (* -> *) -> (* -> *) -> *) | m -> l Source #
type Declaration l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l Source #
type Type l = (t :: * -> (* -> *) -> (* -> *) -> *) | t -> l Source #
type Statement l = (s :: * -> (* -> *) -> (* -> *) -> *) | s -> l Source #
type Expression l = (e :: * -> (* -> *) -> (* -> *) -> *) | e -> l Source #
type Designator l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l Source #
type Value l = (v :: * -> (* -> *) -> (* -> *) -> *) | v -> l Source #
type FieldList l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l Source #
type ProcedureHeading l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l Source #
type FormalParameters l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l Source #
type FPSection l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l Source #
type Block l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l Source #
type StatementSequence l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l Source #
type Case l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l Source #
type CaseLabels l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l Source #
type ConditionalBranch l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l Source #
type Element l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l Source #
type Import l = x | x -> l Source #
constantDeclaration :: IdentDef l' -> f (ConstExpression l' l' f' f') -> Declaration l l' f' f Source #
typeDeclaration :: IdentDef l' -> f (Type l' l' f' f') -> Declaration l l' f' f Source #
variableDeclaration :: IdentList l' -> f (Type l' l' f' f') -> Declaration l l' f' f Source #
procedureDeclaration :: f (ProcedureHeading l' l' f' f') -> f (Block l' l' f' f') -> Declaration l l' f' f Source #
formalParameters :: [f (FPSection l' l' f' f')] -> Maybe (ReturnType l') -> FormalParameters l l' f' f Source #
fpSection :: Bool -> [Ident] -> f (Type l' l' f' f') -> FPSection l l' f' f Source #
block :: [f (Declaration l' l' f' f')] -> Maybe (f (StatementSequence l' l' f' f')) -> Block l l' f' f Source #
fieldList :: NonEmpty (IdentDef l') -> f (Type l' l' f' f') -> FieldList l l' f' f Source #
pointerType :: f (Type l' l' f' f') -> Type l l' f' f Source #
procedureType :: Maybe (f (FormalParameters l' l' f' f')) -> Type l l' f' f Source #
typeReference :: QualIdent l' -> Type l l' f' f Source #
assignment :: f (Designator l' l' f' f') -> f (Expression l' l' f' f') -> Statement l l' f' f Source #
caseStatement :: f (Expression l' l' f' f') -> [f (Case l' l' f' f')] -> Maybe (f (StatementSequence l' l' f' f')) -> Statement l l' f' f Source #
emptyStatement :: Statement l l' f' f Source #
exitStatement :: Statement l l' f' f Source #
ifStatement :: NonEmpty (f (ConditionalBranch l' l' f' f')) -> Maybe (f (StatementSequence l' l' f' f')) -> Statement l l' f' f Source #
loopStatement :: f (StatementSequence l' l' f' f') -> Statement l l' f' f Source #
procedureCall :: f (Designator l' l' f' f') -> Maybe [f (Expression l' l' f' f')] -> Statement l l' f' f Source #
repeatStatement :: f (StatementSequence l' l' f' f') -> f (Expression l' l' f' f') -> Statement l l' f' f Source #
returnStatement :: Maybe (f (Expression l' l' f' f')) -> Statement l l' f' f Source #
whileStatement :: f (Expression l' l' f' f') -> f (StatementSequence l' l' f' f') -> Statement l l' f' f Source #
conditionalBranch :: f (Expression l' l' f' f') -> f (StatementSequence l' l' f' f') -> ConditionalBranch l l' f' f Source #
caseAlternative :: NonEmpty (f (CaseLabels l' l' f' f')) -> f (StatementSequence l' l' f' f') -> Case l l' f' f Source #
singleLabel :: f (ConstExpression l' l' f' f') -> CaseLabels l l' f' f Source #
labelRange :: f (ConstExpression l' l' f' f') -> f (ConstExpression l' l' f' f') -> CaseLabels l l' f' f Source #
statementSequence :: [f (Statement l' l' f' f')] -> StatementSequence l l' f' f Source #
add :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f Source #
subtract :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f Source #
and :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f Source #
or :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f Source #
divide :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f Source #
integerDivide :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f Source #
modulo :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f Source #
multiply :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f Source #
functionCall :: f (Designator l' l' f' f') -> [f (Expression l' l' f' f')] -> Expression l l' f' f Source #
literal :: f (Value l' l' f' f') -> Expression l l' f' f Source #
negative :: f (Expression l' l' f' f') -> Expression l l' f' f Source #
positive :: f (Expression l' l' f' f') -> Expression l l' f' f Source #
not :: f (Expression l' l' f' f') -> Expression l l' f' f Source #
read :: f (Designator l' l' f' f') -> Expression l l' f' f Source #
relation :: RelOp -> f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression l l' f' f Source #
element :: f (Expression l' l' f' f') -> Element l l' f' f Source #
range :: f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Element l l' f' f Source #
integer :: Integer -> Value l l' f' f Source #
nil :: Value l l' f' f Source #
false :: Value l l' f' f Source #
true :: Value l l' f' f Source #
real :: Double -> Value l l' f' f Source #
string :: Text -> Value l l' f' f Source #
charCode :: Int -> Value l l' f' f Source #
builtin :: Text -> Value l l' f' f Source #
variable :: QualIdent l' -> Designator l l' f' f Source #
field :: f (Designator l' l' f' f') -> Ident -> Designator l l' f' f Source #
index :: f (Designator l' l' f' f') -> NonEmpty (f (Expression l' l' f' f')) -> Designator l l' f' f Source #
dereference :: f (Designator l' l' f' f') -> Designator l l' f' f Source #
identDef :: Ident -> IdentDef l Source #
nonQualIdent :: Ident -> QualIdent l Source #
Instances
Wirthy Language Source # | |
Defined in Language.Oberon.AST type Module Language = (m :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Declaration Language = (d :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Type Language = (t :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Statement Language = (s :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Expression Language = (e :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Designator Language = (d :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Value Language = (v :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type FieldList Language = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type ProcedureHeading Language = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type FormalParameters Language = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type FPSection Language = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Block Language = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type StatementSequence Language = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Case Language = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type CaseLabels Language = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type ConditionalBranch Language = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Element Language = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Import Language = (x :: Type) Source # constantDeclaration :: forall l' f (f' :: Type -> Type). IdentDef l' -> f (ConstExpression l' l' f' f') -> Declaration Language l' f' f Source # typeDeclaration :: forall l' f (f' :: Type -> Type). IdentDef l' -> f (Type l' l' f' f') -> Declaration Language l' f' f Source # variableDeclaration :: forall l' f (f' :: Type -> Type). IdentList l' -> f (Type l' l' f' f') -> Declaration Language l' f' f Source # procedureDeclaration :: forall f l' (f' :: Type -> Type). f (ProcedureHeading l' l' f' f') -> f (Block l' l' f' f') -> Declaration Language l' f' f Source # formalParameters :: forall f l' (f' :: Type -> Type). [f (FPSection l' l' f' f')] -> Maybe (ReturnType l') -> FormalParameters Language l' f' f Source # fpSection :: forall f l' (f' :: Type -> Type). Bool -> [Ident] -> f (Type l' l' f' f') -> FPSection Language l' f' f Source # block :: forall f l' (f' :: Type -> Type). [f (Declaration l' l' f' f')] -> Maybe (f (StatementSequence l' l' f' f')) -> Block Language l' f' f Source # fieldList :: forall l' f (f' :: Type -> Type). NonEmpty (IdentDef l') -> f (Type l' l' f' f') -> FieldList Language l' f' f Source # pointerType :: forall f l' (f' :: Type -> Type). f (Type l' l' f' f') -> Type Language l' f' f Source # procedureType :: forall f l' (f' :: Type -> Type). Maybe (f (FormalParameters l' l' f' f')) -> Type Language l' f' f Source # typeReference :: forall l' (f' :: Type -> Type) (f :: Type -> Type). QualIdent l' -> Type Language l' f' f Source # assignment :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> f (Expression l' l' f' f') -> Statement Language l' f' f Source # caseStatement :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> [f (Case l' l' f' f')] -> Maybe (f (StatementSequence l' l' f' f')) -> Statement Language l' f' f Source # emptyStatement :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Statement Language l' f' f Source # exitStatement :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Statement Language l' f' f Source # ifStatement :: forall f l' (f' :: Type -> Type). NonEmpty (f (ConditionalBranch l' l' f' f')) -> Maybe (f (StatementSequence l' l' f' f')) -> Statement Language l' f' f Source # loopStatement :: forall f l' (f' :: Type -> Type). f (StatementSequence l' l' f' f') -> Statement Language l' f' f Source # procedureCall :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> Maybe [f (Expression l' l' f' f')] -> Statement Language l' f' f Source # repeatStatement :: forall f l' (f' :: Type -> Type). f (StatementSequence l' l' f' f') -> f (Expression l' l' f' f') -> Statement Language l' f' f Source # returnStatement :: forall f l' (f' :: Type -> Type). Maybe (f (Expression l' l' f' f')) -> Statement Language l' f' f Source # whileStatement :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (StatementSequence l' l' f' f') -> Statement Language l' f' f Source # conditionalBranch :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (StatementSequence l' l' f' f') -> ConditionalBranch Language l' f' f Source # caseAlternative :: forall f l' (f' :: Type -> Type). NonEmpty (f (CaseLabels l' l' f' f')) -> f (StatementSequence l' l' f' f') -> Case Language l' f' f Source # singleLabel :: forall f l' (f' :: Type -> Type). f (ConstExpression l' l' f' f') -> CaseLabels Language l' f' f Source # labelRange :: forall f l' (f' :: Type -> Type). f (ConstExpression l' l' f' f') -> f (ConstExpression l' l' f' f') -> CaseLabels Language l' f' f Source # statementSequence :: forall f l' (f' :: Type -> Type). [f (Statement l' l' f' f')] -> StatementSequence Language l' f' f Source # add :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression Language l' f' f Source # subtract :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression Language l' f' f Source # and :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression Language l' f' f Source # or :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression Language l' f' f Source # divide :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression Language l' f' f Source # integerDivide :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression Language l' f' f Source # modulo :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression Language l' f' f Source # multiply :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression Language l' f' f Source # functionCall :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> [f (Expression l' l' f' f')] -> Expression Language l' f' f Source # literal :: forall f l' (f' :: Type -> Type). f (Value l' l' f' f') -> Expression Language l' f' f Source # negative :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> Expression Language l' f' f Source # positive :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> Expression Language l' f' f Source # not :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> Expression Language l' f' f Source # read :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> Expression Language l' f' f Source # relation :: forall f l' (f' :: Type -> Type). RelOp -> f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression Language l' f' f Source # element :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> Element Language l' f' f Source # range :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Element Language l' f' f Source # integer :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Integer -> Value Language l' f' f Source # nil :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Value Language l' f' f Source # false :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Value Language l' f' f Source # true :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Value Language l' f' f Source # real :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Double -> Value Language l' f' f Source # string :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Text -> Value Language l' f' f Source # charCode :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Int -> Value Language l' f' f Source # builtin :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Text -> Value Language l' f' f Source # variable :: forall l' (f' :: Type -> Type) (f :: Type -> Type). QualIdent l' -> Designator Language l' f' f Source # field :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> Ident -> Designator Language l' f' f Source # index :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> NonEmpty (f (Expression l' l' f' f')) -> Designator Language l' f' f Source # dereference :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> Designator Language l' f' f Source # | |
Wirthy l => Wirthy (WirthySubsetOf l) Source # | |
Defined in Language.Oberon.Abstract type Module (WirthySubsetOf l) = (m :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Declaration (WirthySubsetOf l) = (d :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Type (WirthySubsetOf l) = (t :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Statement (WirthySubsetOf l) = (s :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Expression (WirthySubsetOf l) = (e :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Designator (WirthySubsetOf l) = (d :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Value (WirthySubsetOf l) = (v :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type FieldList (WirthySubsetOf l) = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type ProcedureHeading (WirthySubsetOf l) = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type FormalParameters (WirthySubsetOf l) = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type FPSection (WirthySubsetOf l) = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Block (WirthySubsetOf l) = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type StatementSequence (WirthySubsetOf l) = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Case (WirthySubsetOf l) = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type CaseLabels (WirthySubsetOf l) = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type ConditionalBranch (WirthySubsetOf l) = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Element (WirthySubsetOf l) = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) Source # type Import (WirthySubsetOf l) = (x :: Type) Source # type IdentDef (WirthySubsetOf l) = (x :: Type) Source # type QualIdent (WirthySubsetOf l) = (x :: Type) Source # constantDeclaration :: forall l' f (f' :: Type -> Type). IdentDef l' -> f (ConstExpression l' l' f' f') -> Declaration (WirthySubsetOf l) l' f' f Source # typeDeclaration :: forall l' f (f' :: Type -> Type). IdentDef l' -> f (Type l' l' f' f') -> Declaration (WirthySubsetOf l) l' f' f Source # variableDeclaration :: forall l' f (f' :: Type -> Type). IdentList l' -> f (Type l' l' f' f') -> Declaration (WirthySubsetOf l) l' f' f Source # procedureDeclaration :: forall f l' (f' :: Type -> Type). f (ProcedureHeading l' l' f' f') -> f (Block l' l' f' f') -> Declaration (WirthySubsetOf l) l' f' f Source # formalParameters :: forall f l' (f' :: Type -> Type). [f (FPSection l' l' f' f')] -> Maybe (ReturnType l') -> FormalParameters (WirthySubsetOf l) l' f' f Source # fpSection :: forall f l' (f' :: Type -> Type). Bool -> [Ident] -> f (Type l' l' f' f') -> FPSection (WirthySubsetOf l) l' f' f Source # block :: forall f l' (f' :: Type -> Type). [f (Declaration l' l' f' f')] -> Maybe (f (StatementSequence l' l' f' f')) -> Block (WirthySubsetOf l) l' f' f Source # fieldList :: forall l' f (f' :: Type -> Type). NonEmpty (IdentDef l') -> f (Type l' l' f' f') -> FieldList (WirthySubsetOf l) l' f' f Source # pointerType :: forall f l' (f' :: Type -> Type). f (Type l' l' f' f') -> Type (WirthySubsetOf l) l' f' f Source # procedureType :: forall f l' (f' :: Type -> Type). Maybe (f (FormalParameters l' l' f' f')) -> Type (WirthySubsetOf l) l' f' f Source # typeReference :: forall l' (f' :: Type -> Type) (f :: Type -> Type). QualIdent l' -> Type (WirthySubsetOf l) l' f' f Source # assignment :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> f (Expression l' l' f' f') -> Statement (WirthySubsetOf l) l' f' f Source # caseStatement :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> [f (Case l' l' f' f')] -> Maybe (f (StatementSequence l' l' f' f')) -> Statement (WirthySubsetOf l) l' f' f Source # emptyStatement :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Statement (WirthySubsetOf l) l' f' f Source # exitStatement :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Statement (WirthySubsetOf l) l' f' f Source # ifStatement :: forall f l' (f' :: Type -> Type). NonEmpty (f (ConditionalBranch l' l' f' f')) -> Maybe (f (StatementSequence l' l' f' f')) -> Statement (WirthySubsetOf l) l' f' f Source # loopStatement :: forall f l' (f' :: Type -> Type). f (StatementSequence l' l' f' f') -> Statement (WirthySubsetOf l) l' f' f Source # procedureCall :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> Maybe [f (Expression l' l' f' f')] -> Statement (WirthySubsetOf l) l' f' f Source # repeatStatement :: forall f l' (f' :: Type -> Type). f (StatementSequence l' l' f' f') -> f (Expression l' l' f' f') -> Statement (WirthySubsetOf l) l' f' f Source # returnStatement :: forall f l' (f' :: Type -> Type). Maybe (f (Expression l' l' f' f')) -> Statement (WirthySubsetOf l) l' f' f Source # whileStatement :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (StatementSequence l' l' f' f') -> Statement (WirthySubsetOf l) l' f' f Source # conditionalBranch :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (StatementSequence l' l' f' f') -> ConditionalBranch (WirthySubsetOf l) l' f' f Source # caseAlternative :: forall f l' (f' :: Type -> Type). NonEmpty (f (CaseLabels l' l' f' f')) -> f (StatementSequence l' l' f' f') -> Case (WirthySubsetOf l) l' f' f Source # singleLabel :: forall f l' (f' :: Type -> Type). f (ConstExpression l' l' f' f') -> CaseLabels (WirthySubsetOf l) l' f' f Source # labelRange :: forall f l' (f' :: Type -> Type). f (ConstExpression l' l' f' f') -> f (ConstExpression l' l' f' f') -> CaseLabels (WirthySubsetOf l) l' f' f Source # statementSequence :: forall f l' (f' :: Type -> Type). [f (Statement l' l' f' f')] -> StatementSequence (WirthySubsetOf l) l' f' f Source # add :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # subtract :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # and :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # or :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # divide :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # integerDivide :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # modulo :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # multiply :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # functionCall :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> [f (Expression l' l' f' f')] -> Expression (WirthySubsetOf l) l' f' f Source # literal :: forall f l' (f' :: Type -> Type). f (Value l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # negative :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # positive :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # not :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # read :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # relation :: forall f l' (f' :: Type -> Type). RelOp -> f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Expression (WirthySubsetOf l) l' f' f Source # element :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> Element (WirthySubsetOf l) l' f' f Source # range :: forall f l' (f' :: Type -> Type). f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Element (WirthySubsetOf l) l' f' f Source # integer :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Integer -> Value (WirthySubsetOf l) l' f' f Source # nil :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Value (WirthySubsetOf l) l' f' f Source # false :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Value (WirthySubsetOf l) l' f' f Source # true :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Value (WirthySubsetOf l) l' f' f Source # real :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Double -> Value (WirthySubsetOf l) l' f' f Source # string :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Text -> Value (WirthySubsetOf l) l' f' f Source # charCode :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Int -> Value (WirthySubsetOf l) l' f' f Source # builtin :: forall l' (f' :: Type -> Type) (f :: Type -> Type). Text -> Value (WirthySubsetOf l) l' f' f Source # variable :: forall l' (f' :: Type -> Type) (f :: Type -> Type). QualIdent l' -> Designator (WirthySubsetOf l) l' f' f Source # field :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> Ident -> Designator (WirthySubsetOf l) l' f' f Source # index :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> NonEmpty (f (Expression l' l' f' f')) -> Designator (WirthySubsetOf l) l' f' f Source # dereference :: forall f l' (f' :: Type -> Type). f (Designator l' l' f' f') -> Designator (WirthySubsetOf l) l' f' f Source # identDef :: Ident -> IdentDef (WirthySubsetOf l) Source # nonQualIdent :: Ident -> QualIdent (WirthySubsetOf l) Source # |
class Wirthy l => CoWirthy l where Source #
An instance of this type can convert its own constructs to another language that's an instance of TargetClass
.
type TargetClass l :: * -> Constraint Source #
type TargetClass l = Wirthy
coDeclaration :: TargetClass l l' => Declaration l l'' f' f -> Declaration l' l'' f' f Source #
coType :: TargetClass l l' => Type l l'' f' f -> Type l' l'' f' f Source #
coStatement :: TargetClass l l' => Statement l l'' f' f -> Statement l' l'' f' f Source #
coExpression :: TargetClass l l' => Expression l l'' f' f -> Expression l' l'' f' f Source #
coDesignator :: TargetClass l l' => Designator l l'' f' f -> Designator l' l'' f' f Source #
coValue :: TargetClass l l' => Value l l'' f' f -> Value l' l'' f' f Source #
Instances
class Wirthy l => Oberon l where Source #
The finally-tagless associated types and methods relevant to both versions of the Oberon language.
type WithAlternative l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l Source #
moduleUnit :: Ident -> [Import l] -> f (Block l' l' f' f') -> Module l l' f' f Source #
moduleImport :: Maybe Ident -> Ident -> Import l Source #
qualIdent :: Ident -> Ident -> QualIdent l Source #
getQualIdentNames :: QualIdent l -> Maybe (Ident, Ident) Source #
exported :: Ident -> IdentDef l Source #
forwardDeclaration :: IdentDef l' -> Maybe (f (FormalParameters l' l' f' f')) -> Declaration l l' f' f Source #
procedureHeading :: Bool -> IdentDef l' -> Maybe (f (FormalParameters l' l' f' f')) -> ProcedureHeading l l' f' f Source #
arrayType :: [f (ConstExpression l' l' f' f')] -> f (Type l' l' f' f') -> Type l l' f' f Source #
recordType :: Maybe (BaseType l') -> [f (FieldList l' l' f' f')] -> Type l l' f' f Source #
withStatement :: f (WithAlternative l' l' f' f') -> Statement l l' f' f Source #
withAlternative :: QualIdent l' -> QualIdent l' -> f (StatementSequence l' l' f' f') -> WithAlternative l l' f' f Source #
is :: f (Expression l' l' f' f') -> QualIdent l' -> Expression l l' f' f Source #
set :: [f (Element l' l' f' f')] -> Expression l l' f' f Source #
typeGuard :: f (Designator l' l' f' f') -> QualIdent l' -> Designator l l' f' f Source #
Instances
class Oberon l => Oberon2 l where Source #
The finally-tagless associated types and methods relevant to the Oberon 2 language.
readOnly :: Ident -> IdentDef l Source #
typeBoundHeading :: Bool -> Ident -> Ident -> Bool -> IdentDef l' -> Maybe (f (FormalParameters l' l' f' f')) -> ProcedureHeading l l' f' f Source #
forStatement :: Ident -> f (Expression l' l' f' f') -> f (Expression l' l' f' f') -> Maybe (f (Expression l' l' f' f')) -> f (StatementSequence l' l' f' f') -> Statement l l' f' f Source #
variantWithStatement :: NonEmpty (f (WithAlternative l' l' f' f')) -> Maybe (f (StatementSequence l' l' f' f')) -> Statement l l' f' f Source #
Instances
class Wirthy l => Nameable l where Source #
Ability to deconstruct named constructs and obtain their Ident
.
getProcedureName :: Nameable l' => ProcedureHeading l l' f' f -> Ident Source #
getIdentDefName :: IdentDef l -> Ident Source #
Instances
Nameable Language Source # | |
Defined in Language.Oberon.AST |
Type synonyms
type ReturnType l = QualIdent l Source #
type ConstExpression l = Expression l Source #
Auxiliary data types
Relational operators
Instances
Eq RelOp Source # | |
Data RelOp Source # | |
Defined in Language.Oberon.Abstract gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RelOp -> c RelOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RelOp # dataTypeOf :: RelOp -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c RelOp) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RelOp) # gmapT :: (forall b. Data b => b -> b) -> RelOp -> RelOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RelOp -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RelOp -> r # gmapQ :: (forall d. Data d => d -> u) -> RelOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> RelOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> RelOp -> m RelOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RelOp -> m RelOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RelOp -> m RelOp # | |
Show RelOp Source # | |
Pretty RelOp Source # | |
Defined in Language.Oberon.Pretty |
data WirthySubsetOf l Source #
A language with constructs beyond the base Wirthy
class will have constructs that cannot be converted to a
| Wirthy
target. It can declare its TargetClass
to be this transformed language instead, whose language
| constructs are all wrapped in Maybe
or Maybe3
.
Instances
newtype Maybe3 f a b c Source #
Instances
Eq (f a b c) => Eq (Maybe3 f a b c) Source # | |
Ord (f a b c) => Ord (Maybe3 f a b c) Source # | |
Defined in Language.Oberon.Abstract compare :: Maybe3 f a b c -> Maybe3 f a b c -> Ordering # (<) :: Maybe3 f a b c -> Maybe3 f a b c -> Bool # (<=) :: Maybe3 f a b c -> Maybe3 f a b c -> Bool # (>) :: Maybe3 f a b c -> Maybe3 f a b c -> Bool # (>=) :: Maybe3 f a b c -> Maybe3 f a b c -> Bool # | |
Read (f a b c) => Read (Maybe3 f a b c) Source # | |
Show (f a b c) => Show (Maybe3 f a b c) Source # | |