Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Defines an AST for defining Modules.
Synopsis
- data Class = ClassDef {
- className :: Name
- implements :: Maybe Name
- classDesc :: Description
- stateVars :: [StateVariable]
- methods :: [Func]
- data StateVariable = SV {
- svScope :: ScopeTag
- stVar :: CodeVarChunk
- data Func
- data FuncData where
- FuncData :: Name -> Description -> DataDesc -> FuncData
- data FuncDef where
- FuncDef :: Name -> Description -> [ParameterChunk] -> Space -> Maybe Description -> [FuncStmt] -> FuncDef
- CtorDef :: Name -> Description -> [ParameterChunk] -> [Initializer] -> [FuncStmt] -> FuncDef
- data FuncStmt where
- FAsg :: CodeVarChunk -> CodeExpr -> FuncStmt
- FAsgIndex :: CodeVarChunk -> Integer -> CodeExpr -> FuncStmt
- FFor :: CodeVarChunk -> CodeExpr -> CodeExpr -> CodeExpr -> [FuncStmt] -> FuncStmt
- FForEach :: CodeVarChunk -> CodeExpr -> [FuncStmt] -> FuncStmt
- FWhile :: CodeExpr -> [FuncStmt] -> FuncStmt
- FCond :: CodeExpr -> [FuncStmt] -> [FuncStmt] -> FuncStmt
- FRet :: CodeExpr -> FuncStmt
- FThrow :: String -> FuncStmt
- FTry :: [FuncStmt] -> [FuncStmt] -> FuncStmt
- FContinue :: FuncStmt
- FDecDef :: CodeVarChunk -> CodeExpr -> FuncStmt
- FFuncDef :: CodeFuncChunk -> [ParameterChunk] -> [FuncStmt] -> FuncStmt
- FVal :: CodeExpr -> FuncStmt
- FMulti :: [FuncStmt] -> FuncStmt
- FAppend :: CodeExpr -> CodeExpr -> FuncStmt
- type Initializer = (CodeVarChunk, CodeExpr)
- data Mod = Mod Name Description [Import] [Class] [Func]
- type Name = String
- type Version = String
- type Description = String
- type Import = String
- ($:=) :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> FuncStmt
- pubStateVar :: CodeVarChunk -> StateVariable
- privStateVar :: CodeVarChunk -> StateVariable
- classDef :: Name -> Description -> [StateVariable] -> [Func] -> Class
- classImplements :: Name -> Name -> Description -> [StateVariable] -> [Func] -> Class
- ctorDef :: Name -> Description -> [ParameterChunk] -> [Initializer] -> [FuncStmt] -> Func
- ffor :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> [FuncStmt] -> FuncStmt
- fforRange :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> CodeExpr -> CodeExpr -> [FuncStmt] -> FuncStmt
- fDecDef :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> FuncStmt
- fname :: Func -> Name
- fstdecl :: ChunkDB -> [FuncStmt] -> [CodeVarChunk]
- funcData :: Name -> Description -> DataDesc -> Func
- funcDef :: (Quantity c, MayHaveUnit c) => Name -> Description -> [c] -> Space -> Maybe Description -> [FuncStmt] -> Func
- funcDefParams :: Name -> Description -> [ParameterChunk] -> Space -> Maybe Description -> [FuncStmt] -> Func
- packmod :: Name -> Description -> [Class] -> [Func] -> Mod
- packmodRequires :: Name -> Description -> [Import] -> [Class] -> [Func] -> Mod
Documentation
Holds information needed to define a class.
ClassDef | |
|
data StateVariable Source #
State variables hold attach a ScopeTag
to a CodeVarChunk
.
SV | |
|
Function data. Holds a name, description, and pieces of data with its own description.
FuncData :: Name -> Description -> DataDesc -> FuncData |
Defines a function.
FuncDef :: Name -> Description -> [ParameterChunk] -> Space -> Maybe Description -> [FuncStmt] -> FuncDef | Parameters are: Name, description, parameters, return type, return description, statements. |
CtorDef :: Name -> Description -> [ParameterChunk] -> [Initializer] -> [FuncStmt] -> FuncDef |
FAsg :: CodeVarChunk -> CodeExpr -> FuncStmt | |
FAsgIndex :: CodeVarChunk -> Integer -> CodeExpr -> FuncStmt | |
FFor :: CodeVarChunk -> CodeExpr -> CodeExpr -> CodeExpr -> [FuncStmt] -> FuncStmt | For-loop; Variable, Start, Stop, Step, Body. |
FForEach :: CodeVarChunk -> CodeExpr -> [FuncStmt] -> FuncStmt | |
FWhile :: CodeExpr -> [FuncStmt] -> FuncStmt | |
FCond :: CodeExpr -> [FuncStmt] -> [FuncStmt] -> FuncStmt | |
FRet :: CodeExpr -> FuncStmt | |
FThrow :: String -> FuncStmt | |
FTry :: [FuncStmt] -> [FuncStmt] -> FuncStmt | |
FContinue :: FuncStmt | |
FDecDef :: CodeVarChunk -> CodeExpr -> FuncStmt | |
FFuncDef :: CodeFuncChunk -> [ParameterChunk] -> [FuncStmt] -> FuncStmt | |
FVal :: CodeExpr -> FuncStmt | |
FMulti :: [FuncStmt] -> FuncStmt | |
FAppend :: CodeExpr -> CodeExpr -> FuncStmt |
type Initializer = (CodeVarChunk, CodeExpr) Source #
Variable-value pair.
type Description = String Source #
Type synonym for clarity.
($:=) :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> FuncStmt Source #
Define an assignment statement.
pubStateVar :: CodeVarChunk -> StateVariable Source #
Define a public state variable based on the given CodeVarChunk
.
privStateVar :: CodeVarChunk -> StateVariable Source #
Define a private state variable based on the given CodeVarChunk
.
classDef :: Name -> Description -> [StateVariable] -> [Func] -> Class Source #
Define a class with the given Name
, Description
, state variables, and
methods.
classImplements :: Name -> Name -> Description -> [StateVariable] -> [Func] -> Class Source #
Define a class that implements an interface. 1st Name
is class name, 2nd is
interface name.
ctorDef :: Name -> Description -> [ParameterChunk] -> [Initializer] -> [FuncStmt] -> Func Source #
Define a constructor, with the given name, description, parameters,
initializers (variable-value pairs), and FuncStmt
s for the body.
fforRange :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> CodeExpr -> CodeExpr -> [FuncStmt] -> FuncStmt Source #
fDecDef :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> FuncStmt Source #
Define a declare-define statement.
fstdecl :: ChunkDB -> [FuncStmt] -> [CodeVarChunk] Source #
Returns the list of CodeVarChunk
s that are used in the list of FuncStmt
s
but are not declared in any of the FuncStmt
s.
funcData :: Name -> Description -> DataDesc -> Func Source #
Define a function that reads data from a file, according to the given
DataDesc
.
funcDef :: (Quantity c, MayHaveUnit c) => Name -> Description -> [c] -> Space -> Maybe Description -> [FuncStmt] -> Func Source #
Define a function by providing the FuncStmt
s for its body. Other
parameters are function name, description, list of parameters, space of the
returned value, and description of the returned value.
funcDefParams :: Name -> Description -> [ParameterChunk] -> Space -> Maybe Description -> [FuncStmt] -> Func Source #
Like funcDef
but uses ParameterChunk
s to represent the parameters.
packmod :: Name -> Description -> [Class] -> [Func] -> Mod Source #
Define a Mod
with the given Name
, Description
, Classes
, and Functions
.
packmodRequires :: Name -> Description -> [Import] -> [Class] -> [Func] -> Mod Source #
Define a Mod
that requires some library imports, with the given Name,
Description, Classes, and Functions.