drasil-code-0.1.9.0: A framework for code and document generation for scientific software - Code SubPackage
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Drasil.Mod

Description

Defines an AST for defining Modules.

Synopsis

Documentation

data Class Source #

Holds information needed to define a class.

data StateVariable Source #

State variables hold attach a ScopeTag to a CodeVarChunk.

Constructors

SV 

data Func Source #

Holds a function definition or function data.

Constructors

FDef FuncDef 
FData FuncData 

data FuncData where Source #

Function data. Holds a name, description, and pieces of data with its own description.

Constructors

FuncData :: Name -> Description -> DataDesc -> FuncData 

data FuncDef where Source #

Defines a function.

Constructors

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 

type Initializer = (CodeVarChunk, CodeExpr) Source #

Variable-value pair.

data Mod Source #

Holds module information.

Constructors

Mod Name Description [Import] [Class] [Func] 

type Name = String Source #

Type synonym for clarity.

type Version = String Source #

Type synonym for clarity.

type Description = String Source #

Type synonym for clarity.

type Import = 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 FuncStmts for the body.

ffor :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> [FuncStmt] -> FuncStmt Source #

Define a for-loop. Quantity is for the iteration variable, CodeExpr is the upper bound at that variable (the variable will start with a value of 0). [FuncStmt] is for the loop body.

fforRange :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> CodeExpr -> CodeExpr -> [FuncStmt] -> FuncStmt Source #

Define a for-loop. Quantity is for the iteration variable, and 3 CodeExprs for the start, stop, step numbers. [FuncStmt] is for the loop body.

fDecDef :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> FuncStmt Source #

Define a declare-define statement.

fname :: Func -> Name Source #

Gets the name of a function.

fstdecl :: ChunkDB -> [FuncStmt] -> [CodeVarChunk] Source #

Returns the list of CodeVarChunks that are used in the list of FuncStmts but are not declared in any of the FuncStmts.

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 FuncStmts 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 ParameterChunks 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.