Safe Haskell | None |
---|---|
Language | Haskell2010 |
The main export of this module is the function foldConstants
that folds the constants in an ISO Modula-2 AST
using an attribute grammar. Other exports are helper functions and attribute types that can be reused for other
languages or attribute grammars.
Synopsis
- foldConstants :: forall l. (Modula2 l, Nameable l, Ord (QualIdent l), Show (QualIdent l), Atts (Inherited (Auto ConstantFold)) (Block l l Sem Sem) ~ InhCF l, Atts (Inherited (Auto ConstantFold)) (Definition l l Sem Sem) ~ InhCF l, Atts (Inherited (Auto ConstantFold)) (Expression l l Sem Sem) ~ InhCF l, Atts (Synthesized (Auto ConstantFold)) (Block l l Sem Sem) ~ SynCFMod' l (Block l l), Atts (Synthesized (Auto ConstantFold)) (Block l l Placed Placed) ~ SynCFMod' l (Block l l), Atts (Synthesized (Auto ConstantFold)) (Definition l l Sem Sem) ~ SynCFMod' l (Definition l l), Atts (Synthesized (Auto ConstantFold)) (Definition l l Placed Placed) ~ SynCFMod' l (Definition l l), Atts (Synthesized (Auto ConstantFold)) (Expression l l Sem Sem) ~ SynCFExp l l, Atts (Synthesized (Auto ConstantFold)) (Expression l l Placed Placed) ~ SynCFExp l l, Functor (Auto ConstantFold) (Block l l), Functor (Auto ConstantFold) (Definition l l), Functor (Auto ConstantFold) (Expression l l)) => Environment l -> Module l l Placed Placed -> Module l l Placed Placed
- data InhCF l
- data SynCF a = SynCF {}
- data SynCFDesignator l = SynCFDesignator {}
- data SynCFExp λ l = SynCFExp {}
- type SynCFMod' l (node :: (Type -> Type) -> (Type -> Type) -> Type) = SynCFMod l (node Placed Placed)
- type Environment l = Map (QualIdent l) (Maybe (Value l l Placed Placed))
Documentation
foldConstants :: forall l. (Modula2 l, Nameable l, Ord (QualIdent l), Show (QualIdent l), Atts (Inherited (Auto ConstantFold)) (Block l l Sem Sem) ~ InhCF l, Atts (Inherited (Auto ConstantFold)) (Definition l l Sem Sem) ~ InhCF l, Atts (Inherited (Auto ConstantFold)) (Expression l l Sem Sem) ~ InhCF l, Atts (Synthesized (Auto ConstantFold)) (Block l l Sem Sem) ~ SynCFMod' l (Block l l), Atts (Synthesized (Auto ConstantFold)) (Block l l Placed Placed) ~ SynCFMod' l (Block l l), Atts (Synthesized (Auto ConstantFold)) (Definition l l Sem Sem) ~ SynCFMod' l (Definition l l), Atts (Synthesized (Auto ConstantFold)) (Definition l l Placed Placed) ~ SynCFMod' l (Definition l l), Atts (Synthesized (Auto ConstantFold)) (Expression l l Sem Sem) ~ SynCFExp l l, Atts (Synthesized (Auto ConstantFold)) (Expression l l Placed Placed) ~ SynCFExp l l, Functor (Auto ConstantFold) (Block l l), Functor (Auto ConstantFold) (Definition l l), Functor (Auto ConstantFold) (Expression l l)) => Environment l -> Module l l Placed Placed -> Module l l Placed Placed Source #
Fold the constants in the given collection of Modula-2 modules (a Map
of modules keyed by module name). It uses
the constant declarations from the modules as well as the given Environment
of predefined constants and
functions.
Note that the ISO Modula-2 Language
satisfies all constraints in the function's type signature.
Instances
Generic (InhCF l) | |
type Rep (InhCF l) | |
Defined in Language.Oberon.ConstantFolder type Rep (InhCF l) = D1 ('MetaData "InhCF" "Language.Oberon.ConstantFolder" "language-oberon-0.3-9UwQStBT68GEv7WM30Tf5c" 'False) (C1 ('MetaCons "InhCF" 'PrefixI 'True) (S1 ('MetaSel ('Just "env") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Environment l)) :*: S1 ('MetaSel ('Just "currentModule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident))) |
Instances
Generic (SynCF a) | |
type Rep (SynCF a) | |
Defined in Language.Oberon.ConstantFolder |
data SynCFDesignator l #
Instances
Generic (SynCFDesignator l) | |
Defined in Language.Oberon.ConstantFolder type Rep (SynCFDesignator l) :: Type -> Type # from :: SynCFDesignator l -> Rep (SynCFDesignator l) x # to :: Rep (SynCFDesignator l) x -> SynCFDesignator l # | |
type Rep (SynCFDesignator l) | |
Defined in Language.Oberon.ConstantFolder type Rep (SynCFDesignator l) = D1 ('MetaData "SynCFDesignator" "Language.Oberon.ConstantFolder" "language-oberon-0.3-9UwQStBT68GEv7WM30Tf5c" 'False) (C1 ('MetaCons "SynCFDesignator" 'PrefixI 'True) (S1 ('MetaSel ('Just "folded") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Mapped Placed (Designator l l Placed Placed))) :*: S1 ('MetaSel ('Just "designatorValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Placed (Value l l Placed Placed)))))) |
type SynCFMod' l (node :: (Type -> Type) -> (Type -> Type) -> Type) = SynCFMod l (node Placed Placed) #