Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Re-export code-related smart constructors for external code writing and generation.
Synopsis
- makeCode :: [FileData] -> [AuxData] -> Code
- createCodeFiles :: Code -> IO ()
- generator :: Lang -> String -> [Expr] -> Choices -> CodeSpec -> DrasilState
- generateCode :: (OOProg progRepr, PackageSym packRepr) => Lang -> (progRepr (Program progRepr) -> ProgData) -> (packRepr (Package packRepr) -> PackData) -> DrasilState -> IO ()
- generateCodeProc :: (ProcProg progRepr, PackageSym packRepr) => Lang -> (progRepr (Program progRepr) -> ProgData) -> (packRepr (Package packRepr) -> PackData) -> DrasilState -> IO ()
- readWithDataDesc :: FilePath -> DataDesc' -> IO [Expr]
- sampleInputDD :: [CodeVarChunk] -> DataDesc'
- data Choices = Choices {
- lang :: [Lang]
- architecture :: Architecture
- dataInfo :: DataInfo
- maps :: Maps
- optFeats :: OptionalFeatures
- srsConstraints :: Constraints
- extLibs :: [ExtLib]
- icNames :: InternalConcept -> Name
- folderVal :: Int
- data Comments
- data Verbosity
- data ConstraintBehaviour
- makeArchit :: Modularity -> ImplementationType -> Architecture
- data Architecture = Archt {}
- data DataInfo = DataInfo {}
- makeData :: Structure -> ConstantStructure -> ConstantRepr -> DataInfo
- data Maps = Maps {}
- makeMaps :: ConceptMatchMap -> SpaceMatch -> Maps
- spaceToCodeType :: Space -> [CodeType]
- makeConstraints :: ConstraintBehaviour -> ConstraintBehaviour -> Constraints
- makeODE :: [ODEInfo] -> [ODELibPckg] -> ODE
- makeDocConfig :: [Comments] -> Verbosity -> Visibility -> DocConfig
- makeLogConfig :: [Logging] -> FilePath -> LogConfig
- data LogConfig = LogConfig {}
- data OptionalFeatures = OptFeats {}
- makeOptFeats :: DocConfig -> LogConfig -> [AuxFile] -> OptionalFeatures
- newtype ExtLib = Math ODE
- data ImplementationType
- data Logging
- data Modularity
- data Structure
- data ConstantStructure
- data ConstantRepr
- data CodeConcept = Pi
- matchConcepts :: HasUID c => [(c, [CodeConcept])] -> ConceptMatchMap
- type SpaceMatch = Space -> [CodeType]
- matchSpaces :: [(Space, [CodeType])] -> SpaceMatch
- data AuxFile
- getSampleData :: Choices -> Maybe FilePath
- data Visibility
- defaultChoices :: Choices
- data CodeSpec = CS {}
- data OldCodeSpec = OldCodeSpec {
- _pName :: Name
- _authors :: People
- _inputs :: [Input]
- _extInputs :: [Input]
- _derivedInputs :: [Derived]
- _outputs :: [Output]
- _configFiles :: [FilePath]
- _execOrder :: [Def]
- _cMap :: ConstraintCEMap
- _constants :: [Const]
- _constMap :: ConstantMap
- _mods :: [Mod]
- _sysinfodb :: ChunkDB
- codeSpec :: SystemInformation -> Choices -> [Mod] -> CodeSpec
- class HasOldCodeSpec c where
- oldCodeSpec :: Lens' c OldCodeSpec
- authorsO :: Lens' c People
- cMapO :: Lens' c ConstraintCEMap
- configFilesO :: Lens' c [FilePath]
- constMapO :: Lens' c ConstantMap
- constantsO :: Lens' c [Const]
- derivedInputsO :: Lens' c [Derived]
- execOrderO :: Lens' c [Def]
- extInputsO :: Lens' c [Input]
- inputsO :: Lens' c [Input]
- modsO :: Lens' c [Mod]
- outputsO :: Lens' c [Output]
- pNameO :: Lens' c Name
- sysinfodbO :: Lens' c ChunkDB
- funcUID :: Func -> UID
- asVC :: Func -> QuantityDict
- ($:=) :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> FuncStmt
- data Mod = Mod Name Description [Import] [Class] [Func]
- data StateVariable
- data Func
- 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
- pubStateVar :: CodeVarChunk -> StateVariable
- privStateVar :: CodeVarChunk -> StateVariable
- fDecDef :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> FuncStmt
- ffor :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> [FuncStmt] -> FuncStmt
- fforRange :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> CodeExpr -> CodeExpr -> [FuncStmt] -> FuncStmt
- funcData :: Name -> Description -> DataDesc -> Func
- funcDef :: (Quantity c, MayHaveUnit c) => Name -> Description -> [c] -> Space -> Maybe Description -> [FuncStmt] -> Func
- packmod :: Name -> Description -> [Class] -> [Func] -> Mod
- junkLine :: Data
- multiLine :: LinePattern -> Delim -> Data
- repeated :: [DataItem] -> LinePattern
- singleLine :: LinePattern -> Delim -> Data
- singleton :: DataItem -> Data
- type ExternalLibrary = [StepGroup]
- data Step
- data FunctionInterface
- data Argument
- externalLib :: [StepGroup] -> ExternalLibrary
- choiceSteps :: [[Step]] -> StepGroup
- choiceStep :: [Step] -> StepGroup
- mandatoryStep :: Step -> StepGroup
- mandatorySteps :: [Step] -> StepGroup
- callStep :: FunctionInterface -> Step
- libFunction :: Requires -> CodeFuncChunk -> [Argument] -> FunctionInterface
- libMethod :: Requires -> CodeVarChunk -> CodeFuncChunk -> [Argument] -> FunctionInterface
- libFunctionWithResult :: Requires -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface
- libMethodWithResult :: Requires -> CodeVarChunk -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface
- libConstructor :: Requires -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface
- libConstructorMultiReqs :: [Requires] -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface
- constructAndReturn :: Requires -> CodeFuncChunk -> [Argument] -> FunctionInterface
- lockedArg :: CodeExpr -> Argument
- lockedNamedArg :: NamedArgument -> CodeExpr -> Argument
- inlineArg :: Space -> Argument
- inlineNamedArg :: NamedArgument -> Space -> Argument
- preDefinedArg :: CodeVarChunk -> Argument
- preDefinedNamedArg :: NamedArgument -> CodeVarChunk -> Argument
- functionArg :: CodeFuncChunk -> [Parameter] -> Step -> Argument
- customObjArg :: [Requires] -> Description -> CodeVarChunk -> CodeFuncChunk -> ClassInfo -> Argument
- recordArg :: Requires -> CodeFuncChunk -> CodeVarChunk -> [CodeVarChunk] -> Argument
- lockedParam :: CodeVarChunk -> Parameter
- unnamedParam :: Space -> Parameter
- customClass :: [MethodInfo] -> ClassInfo
- implementation :: String -> [MethodInfo] -> ClassInfo
- constructorInfo :: CodeFuncChunk -> [Parameter] -> [Step] -> MethodInfo
- methodInfo :: CodeFuncChunk -> Description -> [Parameter] -> Description -> [Step] -> MethodInfo
- methodInfoNoReturn :: CodeFuncChunk -> Description -> [Parameter] -> [Step] -> MethodInfo
- appendCurrSol :: CodeExpr -> Step
- populateSolList :: CodeVarChunk -> CodeVarChunk -> CodeVarChunk -> [Step]
- assignArrayIndex :: Step
- assignSolFromObj :: CodeVarChunk -> Step
- initSolListFromArray :: CodeVarChunk -> Step
- initSolListWithVal :: Step
- solveAndPopulateWhile :: FunctionInterface -> CodeVarChunk -> CodeVarChunk -> FunctionInterface -> CodeVarChunk -> Step
- returnExprList :: Step
- fixedReturn :: CodeExpr -> Step
- fixedReturn' :: Step
- initSolWithVal :: Step
- type ExternalLibraryCall = [StepGroupFill]
- data StepGroupFill = SGF Int [StepFill]
- data StepFill
- newtype FunctionIntFill = FIF [ArgumentFill]
- data ArgumentFill
- data ParameterFill
- data ClassInfoFill
- data MethodInfoFill
- = CIF [ParameterFill] [Initializer] [StepFill]
- | MIF [ParameterFill] (NonEmpty StepFill)
- externalLibCall :: [StepGroupFill] -> ExternalLibraryCall
- choiceStepsFill :: Int -> [StepFill] -> StepGroupFill
- choiceStepFill :: Int -> StepFill -> StepGroupFill
- mandatoryStepFill :: StepFill -> StepGroupFill
- mandatoryStepsFill :: [StepFill] -> StepGroupFill
- callStepFill :: FunctionIntFill -> StepFill
- libCallFill :: [ArgumentFill] -> FunctionIntFill
- userDefinedArgFill :: CodeExpr -> ArgumentFill
- basicArgFill :: CodeExpr -> ArgumentFill
- functionArgFill :: [ParameterFill] -> StepFill -> ArgumentFill
- customObjArgFill :: [StateVariable] -> ClassInfoFill -> ArgumentFill
- recordArgFill :: [CodeExpr] -> ArgumentFill
- unnamedParamFill :: CodeVarChunk -> ParameterFill
- unnamedParamPBVFill :: CodeVarChunk -> ParameterFill
- userDefinedParamFill :: CodeVarChunk -> ParameterFill
- customClassFill :: [MethodInfoFill] -> ClassInfoFill
- implementationFill :: [MethodInfoFill] -> ClassInfoFill
- constructorInfoFill :: [ParameterFill] -> [Initializer] -> [StepFill] -> MethodInfoFill
- methodInfoFill :: [ParameterFill] -> [StepFill] -> MethodInfoFill
- appendCurrSolFill :: CodeVarChunk -> StepFill
- populateSolListFill :: CodeVarChunk -> [StepFill]
- assignArrayIndexFill :: CodeVarChunk -> [CodeExpr] -> StepFill
- assignSolFromObjFill :: CodeVarChunk -> StepFill
- initSolListFromArrayFill :: CodeVarChunk -> StepFill
- initSolListWithValFill :: CodeVarChunk -> CodeExpr -> StepFill
- solveAndPopulateWhileFill :: FunctionIntFill -> CodeExpr -> FunctionIntFill -> CodeVarChunk -> StepFill
- returnExprListFill :: [CodeExpr] -> StepFill
- fixedStatementFill :: StepFill
- fixedStatementFill' :: CodeExpr -> StepFill
- initSolWithValFill :: CodeVarChunk -> CodeExpr -> StepFill
- data Lang
- class AuxiliarySym r => PackageSym r where
- class AuxiliarySym r where
- type Auxiliary r
- type AuxHelper r
- doxConfig :: String -> GOOLState -> Verbosity -> r (Auxiliary r)
- readMe :: ReadMeInfo -> r (Auxiliary r)
- sampleInput :: ChunkDB -> DataDesc -> [Expr] -> r (Auxiliary r)
- optimizeDox :: r (AuxHelper r)
- makefile :: [FilePath] -> ImplementationType -> [Comments] -> GOOLState -> ProgData -> r (Auxiliary r)
- auxHelperDoc :: r (AuxHelper r) -> Doc
- auxFromData :: FilePath -> Doc -> r (Auxiliary r)
- data AuxData
- data PackData
- data CodeChunk
- data CodeVarChunk
- data CodeFuncChunk
- quantvar :: (Quantity c, MayHaveUnit c) => c -> CodeVarChunk
- quantfunc :: (Quantity c, MayHaveUnit c) => c -> CodeFuncChunk
- ccObjVar :: CodeVarChunk -> CodeVarChunk -> CodeVarChunk
- listToArray :: CodeVarChunk -> CodeVarChunk
- field :: CodeExprC r => CodeVarChunk -> CodeVarChunk -> r
- data ODEInfo = ODEInfo {
- indepVar :: CodeVarChunk
- depVar :: CodeVarChunk
- otherVars :: [CodeVarChunk]
- tInit :: CodeExpr
- tFinal :: CodeExpr
- initVal :: [CodeExpr]
- odeSyst :: [CodeExpr]
- odeOpts :: ODEOptions
- odeInfo :: CodeVarChunk -> CodeVarChunk -> [CodeVarChunk] -> CodeExpr -> CodeExpr -> [CodeExpr] -> [CodeExpr] -> ODEOptions -> ODEInfo
- odeInfo' :: [CodeVarChunk] -> ODEOptions -> DifferentialModel -> InitialValueProblem -> ODEInfo
- data ODEOptions = ODEOpts {}
- odeOptions :: ODEMethod -> CodeExpr -> CodeExpr -> CodeExpr -> ODEOptions
- data ODEMethod
- data ODELibPckg = ODELib {
- libName :: Name
- libVers :: Version
- libSpec :: ExternalLibrary
- libCall :: ODEInfo -> ExternalLibraryCall
- libPath :: Maybe FilePath
- compatibleLangs :: [Lang]
- mkODELib :: Name -> Version -> ExternalLibrary -> (ODEInfo -> ExternalLibraryCall) -> FilePath -> [Lang] -> ODELibPckg
- mkODELibNoPath :: Name -> Version -> ExternalLibrary -> (ODEInfo -> ExternalLibraryCall) -> [Lang] -> ODELibPckg
- unPP :: PythonProject a -> a
- unJP :: JavaProject a -> a
- unCSP :: CSharpProject a -> a
- unCPPP :: CppProject a -> a
- unSP :: SwiftProject a -> a
- unJLP :: JuliaProject a -> a
- data NamedArgument
- narg :: (Quantity q, MayHaveUnit q) => q -> NamedArgument
Documentation
generator :: Lang -> String -> [Expr] -> Choices -> CodeSpec -> DrasilState Source #
Initializes the generator's DrasilState
.
Space
parameter is a string representing the date.
\['Expr'\] parameter is the sample input values provided by the user.
generateCode :: (OOProg progRepr, PackageSym packRepr) => Lang -> (progRepr (Program progRepr) -> ProgData) -> (packRepr (Package packRepr) -> PackData) -> DrasilState -> IO () Source #
Generates a package with the given DrasilState
. The passed
un-representation functions determine which target language the package will
be generated in.
generateCodeProc :: (ProcProg progRepr, PackageSym packRepr) => Lang -> (progRepr (Program progRepr) -> ProgData) -> (packRepr (Package packRepr) -> PackData) -> DrasilState -> IO () Source #
Generates a package with the given DrasilState
. The passed
un-representation functions determine which target language the package will
be generated in.
sampleInputDD :: [CodeVarChunk] -> DataDesc' Source #
Defines the DataDesc for the file containing a sample data set, which a user must supply if they want to generate a sample input file.
The instruction indicates how the generated program should be written down. Full details of Choices documentation https://github.com/JacquesCarette/Drasil/wiki/The-Code-Generator
Choices | |
|
Comment implementation options.
CommentFunc | Function/method-level comments. |
CommentClass | Class-level comments. |
CommentMod | File/Module-level comments. |
data ConstraintBehaviour Source #
Constraint behaviour options within program.
makeArchit :: Modularity -> ImplementationType -> Architecture Source #
Constructor to create a Architecture
data Architecture Source #
Architecture of a program
Archt | |
|
Data of a program - how information should be encoded.
DataInfo | |
|
makeData :: Structure -> ConstantStructure -> ConstantRepr -> DataInfo Source #
Constructor to create a DataInfo
Maps for Concepts and Space
makeMaps :: ConceptMatchMap -> SpaceMatch -> Maps Source #
Constructor to create a Maps
makeConstraints :: ConstraintBehaviour -> ConstraintBehaviour -> Constraints Source #
Constructor to create a Constraints
makeDocConfig :: [Comments] -> Verbosity -> Visibility -> DocConfig Source #
Constructor to create a DocConfig
Log Configuration
data OptionalFeatures Source #
makeOptFeats :: DocConfig -> LogConfig -> [AuxFile] -> OptionalFeatures Source #
Constructor to create a OptionalFeatures
data ImplementationType Source #
Program implementation options.
Logging options for function calls and variable assignments. Eq instances required for Logging and Comments because generator needs to check membership of these elements in lists
data Modularity Source #
Modularity of a program.
Variable structure options.
data ConstantStructure Source #
Constants options.
Inline | Inline values for constants. |
WithInputs | Store constants with inputs. |
Store Structure | Store constants separately from inputs, whether bundled or unbundled. |
data ConstantRepr Source #
Options for representing constants in a program.
data CodeConcept Source #
Code concepts. For now, just pi.
Instances
Eq CodeConcept Source # | |
Defined in Language.Drasil.Choices (==) :: CodeConcept -> CodeConcept -> Bool # (/=) :: CodeConcept -> CodeConcept -> Bool # |
matchConcepts :: HasUID c => [(c, [CodeConcept])] -> ConceptMatchMap Source #
Builds a ConceptMatchMap
from an association list of chunks and CodeConcepts
.
type SpaceMatch = Space -> [CodeType] Source #
matchSpaces :: [(Space, [CodeType])] -> SpaceMatch Source #
Builds a SpaceMatch
from an association list of Spaces
and CodeTypes
.
Currently we only support two kind of auxiliary files: sample input file, readme.
To generate a sample input file compatible with the generated program,
FilePath
is the path to the user-provided file containing a sample set of input data.
getSampleData :: Choices -> Maybe FilePath Source #
Gets the file path to a sample input data set from a Choices
structure, if
the user chose to generate a sample input file.
defaultChoices :: Choices Source #
Default choices to be used as the base from which design specifications can be built.
New Code Specification. Holds system information and a reference to OldCodeSpec
.
Instances
data OldCodeSpec Source #
Old Code specifications. Holds information needed to generate code.
OldCodeSpec | |
|
Instances
HasOldCodeSpec OldCodeSpec Source # | |
Defined in Language.Drasil.CodeSpec oldCodeSpec :: Lens' OldCodeSpec OldCodeSpec Source # authorsO :: Lens' OldCodeSpec People Source # cMapO :: Lens' OldCodeSpec ConstraintCEMap Source # configFilesO :: Lens' OldCodeSpec [FilePath] Source # constMapO :: Lens' OldCodeSpec ConstantMap Source # constantsO :: Lens' OldCodeSpec [Const] Source # derivedInputsO :: Lens' OldCodeSpec [Derived] Source # execOrderO :: Lens' OldCodeSpec [Def] Source # extInputsO :: Lens' OldCodeSpec [Input] Source # inputsO :: Lens' OldCodeSpec [Input] Source # modsO :: Lens' OldCodeSpec [Mod] Source # outputsO :: Lens' OldCodeSpec [Output] Source # pNameO :: Lens' OldCodeSpec Name Source # sysinfodbO :: Lens' OldCodeSpec ChunkDB Source # |
codeSpec :: SystemInformation -> Choices -> [Mod] -> CodeSpec Source #
Creates a CodeSpec
using the provided SystemInformation
, Choices
, and Mod
s.
The CodeSpec
consists of the system information and a corresponding OldCodeSpec
.
class HasOldCodeSpec c where Source #
oldCodeSpec :: Lens' c OldCodeSpec Source #
authorsO :: Lens' c People Source #
cMapO :: Lens' c ConstraintCEMap Source #
configFilesO :: Lens' c [FilePath] Source #
constMapO :: Lens' c ConstantMap Source #
constantsO :: Lens' c [Const] Source #
derivedInputsO :: Lens' c [Derived] Source #
execOrderO :: Lens' c [Def] Source #
extInputsO :: Lens' c [Input] Source #
inputsO :: Lens' c [Input] Source #
modsO :: Lens' c [Mod] Source #
outputsO :: Lens' c [Output] Source #
pNameO :: Lens' c Name Source #
sysinfodbO :: Lens' c ChunkDB Source #
Instances
asVC :: Func -> QuantityDict Source #
Convert a Func
to an implementation-stage QuantityDict
representing the
function.
($:=) :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> FuncStmt Source #
Define an assignment statement.
data StateVariable Source #
State variables hold attach a VisibilityTag
to a CodeVarChunk
.
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 |
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
.
fDecDef :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> FuncStmt Source #
Define a declare-define statement.
fforRange :: (Quantity c, MayHaveUnit c) => c -> CodeExpr -> CodeExpr -> CodeExpr -> [FuncStmt] -> FuncStmt Source #
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.
packmod :: Name -> Description -> [Class] -> [Func] -> Mod Source #
Define a Mod
with the given Name
, Description
, Classes
, and Functions
.
multiLine :: LinePattern -> Delim -> Data Source #
Constructor for an unknown amount of lines of data.
repeated :: [DataItem] -> LinePattern Source #
Constructor for data with a repeated pattern.
singleLine :: LinePattern -> Delim -> Data Source #
Constructor for a single line of data.
type ExternalLibrary = [StepGroup] Source #
External library is a group of Step
s
data FunctionInterface Source #
The first item in the Requires
list should be where the function being called is defined.
externalLib :: [StepGroup] -> ExternalLibrary Source #
Specifies an external library.
choiceSteps :: [[Step]] -> StepGroup Source #
To be used when there are multiple options for a group of consecutive steps, where a single use-case-specific factor decides which step group to use.
choiceStep :: [Step] -> StepGroup Source #
To be used when there are multiple options for a single step, where a use-case-specific factor decides which step to use.
mandatoryStep :: Step -> StepGroup Source #
Specifies a step which must exist in some form in every use case.
mandatorySteps :: [Step] -> StepGroup Source #
Specifies multiple consecutive steps that all must exist in some form in every use case.
callStep :: FunctionInterface -> Step Source #
libFunction :: Requires -> CodeFuncChunk -> [Argument] -> FunctionInterface Source #
Specifies a call to an external library function.
libMethod :: Requires -> CodeVarChunk -> CodeFuncChunk -> [Argument] -> FunctionInterface Source #
Specifies a call to an external library method.
libFunctionWithResult :: Requires -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface Source #
Specifies a call to an external library function, where the result is assigned to a variable.
libMethodWithResult :: Requires -> CodeVarChunk -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface Source #
Specifies a call to an external library method, where the result is assigned to a variable.
libConstructor :: Requires -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface Source #
Specifies a call to an external library constructor, where the result is assigned to a variable.
libConstructorMultiReqs :: [Requires] -> CodeFuncChunk -> [Argument] -> CodeVarChunk -> FunctionInterface Source #
Specifies a call to an external library function, where multiple modules from the external library are required, and the result is assigned to a variable.
constructAndReturn :: Requires -> CodeFuncChunk -> [Argument] -> FunctionInterface Source #
Specifies a call to an external library constructor, where the result is returned.
lockedNamedArg :: NamedArgument -> CodeExpr -> Argument Source #
Specifies a named argument that is not use-case-dependent.
inlineArg :: Space -> Argument Source #
Specifies a use-case-dependent argument whose value can be inlined in the call.
inlineNamedArg :: NamedArgument -> Space -> Argument Source #
Specifies a use-case-dependent named argument whose value can be inlined in the call.
preDefinedArg :: CodeVarChunk -> Argument Source #
Specifies use-case-dependent argument whose value must be assigned to a variable before being passed in the call.
preDefinedNamedArg :: NamedArgument -> CodeVarChunk -> Argument Source #
Specifies use-case-dependent named argument whose value must be assigned to a variable before being passed in the call.
functionArg :: CodeFuncChunk -> [Parameter] -> Step -> Argument Source #
Specifies a function type argument, where the body consists of a single step.
customObjArg :: [Requires] -> Description -> CodeVarChunk -> CodeFuncChunk -> ClassInfo -> Argument Source #
Specifies an argument that is an object of a class that must be defined in the calling program.
recordArg :: Requires -> CodeFuncChunk -> CodeVarChunk -> [CodeVarChunk] -> Argument Source #
Specifies an argument that is an object of a class from the external library. The list of [CodeVarChunk] represents fields of the object that must be set in the calling program.
lockedParam :: CodeVarChunk -> Parameter Source #
Specifies a use-case-independent parameter.
unnamedParam :: Space -> Parameter Source #
Specifies a parameter whose name depends on the use case.
customClass :: [MethodInfo] -> ClassInfo Source #
Specifies a class that must be implemented in the calling program.
implementation :: String -> [MethodInfo] -> ClassInfo Source #
Specifies an implementation of an interface from the external library.
constructorInfo :: CodeFuncChunk -> [Parameter] -> [Step] -> MethodInfo Source #
Specifies a constructor.
methodInfo :: CodeFuncChunk -> Description -> [Parameter] -> Description -> [Step] -> MethodInfo Source #
Specifies a method.
methodInfoNoReturn :: CodeFuncChunk -> Description -> [Parameter] -> [Step] -> MethodInfo Source #
Specifies a method that does not return anything.
appendCurrSol :: CodeExpr -> Step Source #
Specifies a statement where a current solution is appended to a solution list.
populateSolList :: CodeVarChunk -> CodeVarChunk -> CodeVarChunk -> [Step] Source #
Specifies a statement where a solution list is populated by iterating through a solution array.
assignArrayIndex :: Step Source #
Specifies statements where every index of an array is assigned a value.
assignSolFromObj :: CodeVarChunk -> Step Source #
Specifies a statement where a solution is assigned from the field of an object.
initSolListFromArray :: CodeVarChunk -> Step Source #
Specifies a statement where a solution list is initialized with the first element of an array.
initSolListWithVal :: Step Source #
Specifies a statement where a solution list is initialized with the first value.
solveAndPopulateWhile :: FunctionInterface -> CodeVarChunk -> CodeVarChunk -> FunctionInterface -> CodeVarChunk -> Step Source #
A solve and populate loop. FunctionInterface
for loop condition, CodeChunk
for solution object,
CodeChunk
for independent var, FunctionInterface
for solving,
CodeChunk
for soln array to populate with.
returnExprList :: Step Source #
Specifies a statement where a list is returned, where each value of the list is explicitly defined.
fixedReturn :: CodeExpr -> Step Source #
Specifies a use-case-independent statement that returns a fixed value.
fixedReturn' :: Step Source #
Specifies a use-case-dependent statement that returns a non-fixed value.
initSolWithVal :: Step Source #
Specifies a statement where a single solution is initialized with a value.
type ExternalLibraryCall = [StepGroupFill] Source #
External library call holds a group of step groups.
data StepGroupFill Source #
Holds a group of steps (StepFill
s). The
Int is to "choose" from the options in ExternalLibrary
.
Mirrors ExternalLibrary's Step
. A StepFill can be a call to an external library function or method.
data ArgumentFill Source #
Mirrors ExternalLibrary's ArgumentInfo
. Determines the context needed for an argument to work.
UserDefinedArgF (Maybe NamedArgument) CodeExpr | For arguments that are completely dependent on use case. |
BasicF CodeExpr | A basic function. |
FnF [ParameterFill] StepFill | Fills in the names for the unnamed parameters. |
ClassF [StateVariable] ClassInfoFill | List of CodeChunk for state variables. |
RecordF [CodeExpr] | Fills in the field values. |
data ParameterFill Source #
Mirrors ExternalLibrary's Parameter
.
data ClassInfoFill Source #
Mirrors ExternalLibrary's ClassInfo
.
data MethodInfoFill Source #
Mirrors ExternalLibrary's MethodInfo
.
CIF [ParameterFill] [Initializer] [StepFill] | |
MIF [ParameterFill] (NonEmpty StepFill) |
externalLibCall :: [StepGroupFill] -> ExternalLibraryCall Source #
Constructs an ExternalLibraryCall specification.
choiceStepsFill :: Int -> [StepFill] -> StepGroupFill Source #
Corresponds to ExternalLibrary's choiceSteps
. Provides the index of the
steps that should be used for the current use case.
choiceStepFill :: Int -> StepFill -> StepGroupFill Source #
Corresponds to ExternalLibrary's choiceStep
. Provides the index of the
step that should be used for the current use case.
mandatoryStepFill :: StepFill -> StepGroupFill Source #
Corresponds to ExternalLibrary's mandatorySteps
.
mandatoryStepsFill :: [StepFill] -> StepGroupFill Source #
Corresponds to ExternalLibrary's mandatoryStep
.
callStepFill :: FunctionIntFill -> StepFill Source #
Corresponds to ExternalLibrary's callStep
.
libCallFill :: [ArgumentFill] -> FunctionIntFill Source #
Corresponds to any of ExternalLibrary's FunctionInterface
constructors.
userDefinedArgFill :: CodeExpr -> ArgumentFill Source #
Does not correspond to anything in ExternalLibrary. To be used when the presence of an argument is only a consequence of the use case.
basicArgFill :: CodeExpr -> ArgumentFill Source #
Corresponds to ExternalLibrary's inlineArg
, inlineNamedArg
, preDefinedArg
,
and preDefinedNamedArg
. Provides the CodeExpr
for the argument's value.
functionArgFill :: [ParameterFill] -> StepFill -> ArgumentFill Source #
Corresponds to ExternalLibrary's functionArg
.
customObjArgFill :: [StateVariable] -> ClassInfoFill -> ArgumentFill Source #
Corresponds to ExternalLibrary's customObjArg
. Provides the list of state
variables for the class that must be written in the calling program.
recordArgFill :: [CodeExpr] -> ArgumentFill Source #
Corresponds to ExternalLibrary's recordArg
. Provides the list of CodeExpr
s for
the values of the fields that must be set by the calling program.
unnamedParamFill :: CodeVarChunk -> ParameterFill Source #
Corresponds to ExternalLibrary's unnamedParam
. Provides the CodeVarChunk
representing the parameter.
unnamedParamPBVFill :: CodeVarChunk -> ParameterFill Source #
Corresponds to ExternalLibrary's unnamedParam
. Provides the CodeVarChunk
representing the parameter. Specifies that the parameter is passed by value.
userDefinedParamFill :: CodeVarChunk -> ParameterFill Source #
Does not correspond to anything in ExternalLibrary. To be used when the presence of a parameter is only a consequence of the use case.
customClassFill :: [MethodInfoFill] -> ClassInfoFill Source #
Corresponds to ExternalLibrary's customClass
.
implementationFill :: [MethodInfoFill] -> ClassInfoFill Source #
Corresponds to ExternalLibrary's implementation
.
constructorInfoFill :: [ParameterFill] -> [Initializer] -> [StepFill] -> MethodInfoFill Source #
Corresponds to ExternalLibrary's constructorInfo
. Provides Variable-Value
pairs for variables initialized by the constructor.
methodInfoFill :: [ParameterFill] -> [StepFill] -> MethodInfoFill Source #
Corresponds to ExternalLibrary's methodInfo
.
appendCurrSolFill :: CodeVarChunk -> StepFill Source #
Corresponds to ExternalLibrary's appendCurrSol
. Provides the CodeVarChunk
for the solution list.
populateSolListFill :: CodeVarChunk -> [StepFill] Source #
Corresponds to ExternalLibrary's populateSolList
. Provides the CodeVarChunk
for the solution list.
assignArrayIndexFill :: CodeVarChunk -> [CodeExpr] -> StepFill Source #
Corresponds to ExternalLibrary's assignArrayIndex
. Provides the CodeVarChunk
for the array variable. Provides the CodeExpr
s for the values to assign to each
array index.
assignSolFromObjFill :: CodeVarChunk -> StepFill Source #
Corresponds to ExternalLibrary's assignSolFromObj
. Provides the CodeVarChunk
for the variable that the solution should be assigned to.
initSolListFromArrayFill :: CodeVarChunk -> StepFill Source #
Corresponds to ExternalLibrary's initSolListFromArray
. Provides the
CodeVarChunk
for the solution list.
initSolListWithValFill :: CodeVarChunk -> CodeExpr -> StepFill Source #
Corresponds to ExternalLibrary's initSolListWithVal
. Provides the
CodeVarChunk
for the solution list and the CodeExpr
for the initial element of
the solution list
solveAndPopulateWhileFill :: FunctionIntFill -> CodeExpr -> FunctionIntFill -> CodeVarChunk -> StepFill Source #
Corresponds to ExternalLibrary's solveAndPopulateWhile
. Provides the CodeExpr
for the upper bound in the while loop condition and the CodeVarChunk
for the
solution list.
returnExprListFill :: [CodeExpr] -> StepFill Source #
Corresponds to ExternalLibrary's returnExprList
. Provides the list of CodeExpr
s
to return.
fixedStatementFill :: StepFill Source #
Corresponds to ExternalLibrary's fixedReturn
.
No parameters because the statement is not use-case-dependent.
fixedStatementFill' :: CodeExpr -> StepFill Source #
Corresponds to ExternalLibrary's fixedReturn'
.
use-case-specific a CodeExpr
that parameterize the statement.
initSolWithValFill :: CodeVarChunk -> CodeExpr -> StepFill Source #
Corresponds to ExternalLibrary's initSolWithVal
. Provides the
CodeVarChunk
for one solution and one CodeExpr
for the initial element of
the solution list
Various OO languages where code may be generated.
class AuxiliarySym r => PackageSym r where Source #
Members of this class must have all the information necessary for
the AuxiliarySym
in addition to information necessary to create a package.
Instances
class AuxiliarySym r where Source #
Members of this class must have a doxygen configuration, ReadMe file, sample input, omptimize doxygen document, information necessary for a makefile, auxiliary helper documents, and auxiliary from data documents.
doxConfig :: String -> GOOLState -> Verbosity -> r (Auxiliary r) Source #
readMe :: ReadMeInfo -> r (Auxiliary r) Source #
sampleInput :: ChunkDB -> DataDesc -> [Expr] -> r (Auxiliary r) Source #
optimizeDox :: r (AuxHelper r) Source #
makefile :: [FilePath] -> ImplementationType -> [Comments] -> GOOLState -> ProgData -> r (Auxiliary r) Source #
auxHelperDoc :: r (AuxHelper r) -> Doc Source #
Instances
Basic chunk representation in the code generation context. Contains a QuantityDict and the kind of code (variable or function).
Instances
CodeIdea CodeChunk Source # | Finds the code name of a |
Idea CodeChunk | Finds the idea contained in the |
NamedIdea CodeChunk | Finds the term ( |
Defined in Language.Drasil.Chunk.CodeVar | |
MayHaveUnit CodeChunk | Finds the units of the |
Quantity CodeChunk | |
Defined in Language.Drasil.Chunk.CodeVar | |
HasSpace CodeChunk | Finds the |
Defined in Language.Drasil.Chunk.CodeVar | |
HasSymbol CodeChunk | Finds the |
HasUID CodeChunk | Finds the |
Defined in Language.Drasil.Chunk.CodeVar | |
Eq CodeChunk | Equal if |
data CodeVarChunk #
Chunk representing a variable. The obv
field represents the object containing
this variable, if it is an object field.
Instances
data CodeFuncChunk #
Chunk representing a function.
Instances
quantvar :: (Quantity c, MayHaveUnit c) => c -> CodeVarChunk Source #
Construct a CodeVarChunk
from a Quantity
.
quantfunc :: (Quantity c, MayHaveUnit c) => c -> CodeFuncChunk Source #
Construct a CodeFuncChunk
from a Quantity
.
ccObjVar :: CodeVarChunk -> CodeVarChunk -> CodeVarChunk Source #
listToArray :: CodeVarChunk -> CodeVarChunk #
field :: CodeExprC r => CodeVarChunk -> CodeVarChunk -> r #
Constructs a CodeExpr representing the field of an actor
Structure to hold ODE information.
ODEInfo | |
|
odeInfo :: CodeVarChunk -> CodeVarChunk -> [CodeVarChunk] -> CodeExpr -> CodeExpr -> [CodeExpr] -> [CodeExpr] -> ODEOptions -> ODEInfo Source #
Basic ODEInfo
constructor.
odeInfo' :: [CodeVarChunk] -> ODEOptions -> DifferentialModel -> InitialValueProblem -> ODEInfo Source #
Create ODEInfo with Other variables, ODEOptions, DifferentialModel, and InitialValueProblem
data ODEOptions Source #
Other parameters for solving the ODE numerically
odeOptions :: ODEMethod -> CodeExpr -> CodeExpr -> CodeExpr -> ODEOptions Source #
Basic ODEOptions
constructor
Methods for solving ODEs. Includes Runge-Kutta 4-5, Backwards Differentiation Formula, or Adams' method.
data ODELibPckg Source #
Holds an ODE library package.
ODELib | |
|
mkODELib :: Name -> Version -> ExternalLibrary -> (ODEInfo -> ExternalLibraryCall) -> FilePath -> [Lang] -> ODELibPckg Source #
Makes an ODELibPckg
with the given name, ExternalLibrary
specification,
ExternalLibraryCall
specification parameterized by an ODEInfo
, local file
path to the library, and list of compatible languages.
mkODELibNoPath :: Name -> Version -> ExternalLibrary -> (ODEInfo -> ExternalLibraryCall) -> [Lang] -> ODELibPckg Source #
Makes an ODELibPckg
with the given name, ExternalLibrary
specification,
ExternalLibraryCall
specification parameterized by an ODEInfo
, and list of
compatible languages.
unPP :: PythonProject a -> a Source #
unJP :: JavaProject a -> a Source #
unCSP :: CSharpProject a -> a Source #
unCPPP :: CppProject a -> a Source #
unSP :: SwiftProject a -> a Source #
unJLP :: JuliaProject a -> a Source #
data NamedArgument Source #
Any quantity can be a named argument (wrapper for QuantityDict
),
but with more of a focus on generating code arguments.
Instances
narg :: (Quantity q, MayHaveUnit q) => q -> NamedArgument Source #
Smart constructor for NamedArgument
.