| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Language.Drasil.Code
Description
Re-export code-related smart constructors for external code writing and generation.
Synopsis
- field :: CodeExprC r => CodeVarChunk -> CodeVarChunk -> r
- data CodeChunk
- data CodeVarChunk
- data CodeFuncChunk
- quantvar :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeVarChunk
- listToArray :: CodeVarChunk -> CodeVarChunk
- quantfunc :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeFuncChunk
- data SoftwareDossierState
- makeSds :: [FilePath] -> [FilePath] -> Maybe FilePath -> SoftwareDossierState
- module Language.Drasil.Code.Imperative.Generator
- module Language.Drasil.Code.Imperative.ReadInput
- singleton :: DataItem -> Data
- junkLine :: Data
- multiLine :: LinePattern -> Delim -> Data
- repeated :: [DataItem] -> LinePattern
- singleLine :: LinePattern -> Delim -> Data
- data Argument
- implementation :: String -> [MethodInfo] -> ClassInfo
- data Step
- type ExternalLibrary = [StepGroup]
- data FunctionInterface
- 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
- 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
- module Language.Drasil.Code.ExternalLibraryCall
- module Language.Drasil.Code.Lang
- data Visibility
- data ConstantRepr
- data ConstraintBehaviour
- data ImplementationType
- newtype ExtLib = Math ODE
- data Verbosity
- data ConstantStructure
- data Choices = Choices {
- lang :: [Lang]
- architecture :: Architecture
- dataInfo :: DataInfo
- maps :: Maps
- optFeats :: OptionalFeatures
- srsConstraints :: Constraints
- extLibs :: [ExtLib]
- icNames :: InternalConcept -> Name
- folderVal :: Int
- defaultConfigFiles :: [RelativeFile]
- extraMods :: [Mod]
- handWiredDefs :: [SimpleQDef]
- data Comments
- data Logging
- data Modularity
- data Structure
- data CodeConcept = Pi
- matchConcepts :: HasUID c => [(c, [CodeConcept])] -> ConceptMatchMap
- type SpaceMatch = Space -> [CodeType]
- matchSpaces :: [(Space, [CodeType])] -> SpaceMatch
- data SoftwareDossierFile
- getSampleData :: Choices -> Maybe FilePath
- defaultChoices :: Choices
- 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 -> [SoftwareDossierFile] -> OptionalFeatures
- class HasCodeSpec c where
- codeSpec :: Lens' c CodeSpec
- cMap :: Lens' c ConstraintCEMap
- configFiles :: Lens' c [RelativeFile]
- constDefns :: Lens' c [Const]
- constMap :: Lens' c ConstantMap
- derivedInputs :: Lens' c [Derived]
- execOrder :: Lens' c [Def]
- extInputs :: Lens' c [Input]
- inputs :: Lens' c [Input]
- mods :: Lens' c [Mod]
- outputs :: Lens' c [Output]
- srs :: Lens' c SmithEtAlSRS
- data CodeSpec
- mkCodeSpec :: SmithEtAlSRS -> Choices -> CodeSpec
- funcUID :: Func -> UID
- asVC :: Func -> DefinedQuantityDict
- data Mod = Mod Name Description [Import] [Class] [Func]
- data Func
- ($:=) :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeExpr -> FuncStmt
- data StateVariable
- 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, Concept c) => c -> CodeExpr -> FuncStmt
- ffor :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeExpr -> [FuncStmt] -> FuncStmt
- fforRange :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeExpr -> CodeExpr -> CodeExpr -> [FuncStmt] -> FuncStmt
- funcData :: Name -> Description -> DataDesc -> Func
- funcDef :: (Quantity c, MayHaveUnit c, Concept c) => Name -> Description -> [c] -> Space -> Maybe Description -> [FuncStmt] -> Func
- packmod :: Name -> Description -> [Class] -> [Func] -> Mod
- module Language.Drasil.Chunk.Code
- data NamedArgument
- narg :: (Quantity q, MayHaveUnit q, Concept q) => q -> NamedArgument
- module Language.Drasil.Data.ODEInfo
- module Language.Drasil.Data.ODELibPckg
- codeDQDs :: [DefinedQuantityDict]
Documentation
field :: CodeExprC r => CodeVarChunk -> CodeVarChunk -> r #
Constructs a CodeExpr representing the field of an actor
Basic chunk representation in the code generation context. Contains a DefinedQuantityDict and the kind of code (variable or function).
Instances
data CodeVarChunk #
Chunk representing a variable. The obv field represents the object containing
this variable, if it is an object field.
Instances
| HasChunkRefs CodeVarChunk | |||||
Defined in Drasil.Code.CodeVar Methods chunkRefs :: CodeVarChunk -> Set UID # | |||||
| HasUID CodeVarChunk | Finds the | ||||
Defined in Drasil.Code.CodeVar Methods uid :: Getter CodeVarChunk UID # | |||||
| CodeIdea CodeVarChunk Source # | Finds the code name and | ||||
Defined in Language.Drasil.Chunk.Code | |||||
| Idea CodeVarChunk | Finds the idea contained in the | ||||
Defined in Drasil.Code.CodeVar Methods getA :: CodeVarChunk -> Maybe String # | |||||
| NamedIdea CodeVarChunk | Finds the term ( | ||||
Defined in Drasil.Code.CodeVar Methods term :: Lens' CodeVarChunk NP # | |||||
| MayHaveUnit CodeVarChunk | Finds the units of the | ||||
Defined in Drasil.Code.CodeVar Methods getUnit :: CodeVarChunk -> Maybe UnitDefn # | |||||
| Definition CodeVarChunk | |||||
Defined in Drasil.Code.CodeVar Methods defn :: Lens' CodeVarChunk Sentence # | |||||
| HasSpace CodeVarChunk | Finds the | ||||
Defined in Drasil.Code.CodeVar Methods typ :: Getter CodeVarChunk Space # | |||||
| HasSymbol CodeVarChunk | Finds the | ||||
Defined in Drasil.Code.CodeVar Methods symbol :: CodeVarChunk -> Stage -> Symbol # | |||||
| Generic CodeVarChunk | |||||
Defined in Drasil.Code.CodeVar Associated Types
| |||||
| Eq CodeVarChunk | Equal if | ||||
Defined in Drasil.Code.CodeVar | |||||
| type Rep CodeVarChunk | |||||
Defined in Drasil.Code.CodeVar type Rep CodeVarChunk = D1 ('MetaData "CodeVarChunk" "Drasil.Code.CodeVar" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'False) (C1 ('MetaCons "CodeVC" 'PrefixI 'True) (S1 ('MetaSel ('Just "_ccv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CodeChunk) :*: S1 ('MetaSel ('Just "_obv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe CodeChunk)))) | |||||
data CodeFuncChunk #
Chunk representing a function.
Instances
| HasChunkRefs CodeFuncChunk | |||||
Defined in Drasil.Code.CodeVar Methods chunkRefs :: CodeFuncChunk -> Set UID # | |||||
| HasUID CodeFuncChunk | Finds the | ||||
Defined in Drasil.Code.CodeVar Methods uid :: Getter CodeFuncChunk UID # | |||||
| Callable CodeFuncChunk | Functions are Callable. | ||||
Defined in Drasil.Code.CodeVar | |||||
| CodeIdea CodeFuncChunk Source # | Finds the code name and | ||||
Defined in Language.Drasil.Chunk.Code | |||||
| Idea CodeFuncChunk | Finds the idea contained in the | ||||
Defined in Drasil.Code.CodeVar Methods getA :: CodeFuncChunk -> Maybe String # | |||||
| NamedIdea CodeFuncChunk | Finds the term ( | ||||
Defined in Drasil.Code.CodeVar Methods term :: Lens' CodeFuncChunk NP # | |||||
| MayHaveUnit CodeFuncChunk | Finds the units of the | ||||
Defined in Drasil.Code.CodeVar Methods getUnit :: CodeFuncChunk -> Maybe UnitDefn # | |||||
| Definition CodeFuncChunk | Finds the Definition of the | ||||
Defined in Drasil.Code.CodeVar Methods defn :: Lens' CodeFuncChunk Sentence # | |||||
| HasSpace CodeFuncChunk | Finds the | ||||
Defined in Drasil.Code.CodeVar Methods typ :: Getter CodeFuncChunk Space # | |||||
| HasSymbol CodeFuncChunk | Finds the | ||||
Defined in Drasil.Code.CodeVar Methods symbol :: CodeFuncChunk -> Stage -> Symbol # | |||||
| Generic CodeFuncChunk | |||||
Defined in Drasil.Code.CodeVar Associated Types
| |||||
| Eq CodeFuncChunk | Equal if | ||||
Defined in Drasil.Code.CodeVar Methods (==) :: CodeFuncChunk -> CodeFuncChunk -> Bool # (/=) :: CodeFuncChunk -> CodeFuncChunk -> Bool # | |||||
| type Rep CodeFuncChunk | |||||
Defined in Drasil.Code.CodeVar type Rep CodeFuncChunk = D1 ('MetaData "CodeFuncChunk" "Drasil.Code.CodeVar" "drasil-lang-0.1.60.0-1HMwkmtaiHpDlCGzFv9lso" 'True) (C1 ('MetaCons "CodeFC" 'PrefixI 'True) (S1 ('MetaSel ('Just "_ccf") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CodeChunk))) | |||||
quantvar :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeVarChunk #
Construct a CodeVarChunk from a Quantity.
listToArray :: CodeVarChunk -> CodeVarChunk #
quantfunc :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeFuncChunk #
Construct a CodeFuncChunk from a Quantity.
data SoftwareDossierState Source #
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.
implementation :: String -> [MethodInfo] -> ClassInfo Source #
Specifies an implementation of an interface from the external library.
type ExternalLibrary = [StepGroup] Source #
External library is a group of Steps
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.
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 value of an array.
initSolListWithVal :: Step Source #
Specifies a statement where a solution list is initialized with the given 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.
module Language.Drasil.Code.Lang
data ConstantRepr Source #
Options for representing constants in a program.
data ConstraintBehaviour Source #
Constraint behaviour options within program.
data ImplementationType Source #
Program implementation options.
data ConstantStructure Source #
Constants options.
Constructors
| Inline | Inline values for constants. |
| WithInputs | Store constants with inputs. |
| Store Structure | Store constants separately from inputs, whether bundled or unbundled. |
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
Constructors
| Choices | |
Fields
| |
Comment implementation options.
Constructors
| CommentFunc | Function/method-level comments. |
| CommentClass | Class-level comments. |
| CommentMod | File/Module-level comments. |
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 CodeConcept Source #
Code concepts. For now, just pi.
Constructors
| Pi |
Instances
| Eq CodeConcept Source # | |
Defined in Language.Drasil.Choices | |
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.
data SoftwareDossierFile Source #
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.
Constructors
| SampleInput FilePath | |
| ReadME |
Instances
| Eq SoftwareDossierFile Source # | |
Defined in Language.Drasil.Choices Methods (==) :: SoftwareDossierFile -> SoftwareDossierFile -> Bool # (/=) :: SoftwareDossierFile -> SoftwareDossierFile -> Bool # | |
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.
makeArchit :: Modularity -> ImplementationType -> Architecture Source #
Constructor to create a Architecture
data Architecture Source #
Architecture of a program
Constructors
| Archt | |
Fields
| |
Data of a program - how information should be encoded.
Constructors
| DataInfo | |
Fields
| |
makeData :: Structure -> ConstantStructure -> ConstantRepr -> DataInfo Source #
Constructor to create a DataInfo
Maps for Concepts and Space
Constructors
| Maps | |
Fields | |
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 -> [SoftwareDossierFile] -> OptionalFeatures Source #
Constructor to create a OptionalFeatures
class HasCodeSpec c where Source #
Minimal complete definition
Methods
codeSpec :: Lens' c CodeSpec Source #
cMap :: Lens' c ConstraintCEMap Source #
configFiles :: Lens' c [RelativeFile] Source #
constDefns :: Lens' c [Const] Source #
constMap :: Lens' c ConstantMap Source #
derivedInputs :: Lens' c [Derived] Source #
execOrder :: Lens' c [Def] Source #
extInputs :: Lens' c [Input] Source #
inputs :: Lens' c [Input] Source #
mods :: Lens' c [Mod] Source #
outputs :: Lens' c [Output] Source #
srs :: Lens' c SmithEtAlSRS Source #
Instances
| HasCodeSpec DrasilState Source # | |
Defined in Language.Drasil.Code.Imperative.DrasilState Methods codeSpec :: Lens' DrasilState CodeSpec Source # cMap :: Lens' DrasilState ConstraintCEMap Source # configFiles :: Lens' DrasilState [RelativeFile] Source # constDefns :: Lens' DrasilState [Const] Source # constMap :: Lens' DrasilState ConstantMap Source # derivedInputs :: Lens' DrasilState [Derived] Source # execOrder :: Lens' DrasilState [Def] Source # extInputs :: Lens' DrasilState [Input] Source # inputs :: Lens' DrasilState [Input] Source # mods :: Lens' DrasilState [Mod] Source # outputs :: Lens' DrasilState [Output] Source # srs :: Lens' DrasilState SmithEtAlSRS Source # | |
| HasCodeSpec CodeSpec Source # | |
Defined in Language.Drasil.CodeSpec Methods codeSpec :: Lens' CodeSpec CodeSpec Source # cMap :: Lens' CodeSpec ConstraintCEMap Source # configFiles :: Lens' CodeSpec [RelativeFile] Source # constDefns :: Lens' CodeSpec [Const] Source # constMap :: Lens' CodeSpec ConstantMap Source # derivedInputs :: Lens' CodeSpec [Derived] Source # execOrder :: Lens' CodeSpec [Def] Source # extInputs :: Lens' CodeSpec [Input] Source # inputs :: Lens' CodeSpec [Input] Source # mods :: Lens' CodeSpec [Mod] Source # outputs :: Lens' CodeSpec [Output] Source # srs :: Lens' CodeSpec SmithEtAlSRS Source # | |
Code Specification. Holds system information and options.
Instances
| HasCodeSpec CodeSpec Source # | |
Defined in Language.Drasil.CodeSpec Methods codeSpec :: Lens' CodeSpec CodeSpec Source # cMap :: Lens' CodeSpec ConstraintCEMap Source # configFiles :: Lens' CodeSpec [RelativeFile] Source # constDefns :: Lens' CodeSpec [Const] Source # constMap :: Lens' CodeSpec ConstantMap Source # derivedInputs :: Lens' CodeSpec [Derived] Source # execOrder :: Lens' CodeSpec [Def] Source # extInputs :: Lens' CodeSpec [Input] Source # inputs :: Lens' CodeSpec [Input] Source # mods :: Lens' CodeSpec [Mod] Source # outputs :: Lens' CodeSpec [Output] Source # srs :: Lens' CodeSpec SmithEtAlSRS Source # | |
| HasSmithEtAlSRS CodeSpec Source # | |
Defined in Language.Drasil.CodeSpec Methods smithEtAlSRS :: Lens' CodeSpec SmithEtAlSRS # constants :: Lens' CodeSpec [ConstQDef] # dataDefns :: Lens' CodeSpec [DataDefinition] # genDefns :: Lens' CodeSpec [GenDefn] # instModels :: Lens' CodeSpec [InstanceModel] # meta :: Lens' CodeSpec SystemMeta # programName :: Lens' CodeSpec String # quantities :: Lens' CodeSpec [DefinedQuantityDict] # refbyTable :: Lens' CodeSpec (Map UID [UID]) # theoryModels :: Lens' CodeSpec [TheoryModel] # | |
| HasSystemMeta CodeSpec Source # | |
Defined in Language.Drasil.CodeSpec | |
mkCodeSpec :: SmithEtAlSRS -> Choices -> CodeSpec Source #
asVC :: Func -> DefinedQuantityDict Source #
Convert a Func to an implementation-stage DefinedQuantityDict representing the
function.
($:=) :: (Quantity c, MayHaveUnit c, Concept c) => c -> CodeExpr -> FuncStmt Source #
Define an assignment statement.
data StateVariable Source #
State variables hold attach a VisibilityTag to a CodeVarChunk.
Constructors
| 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, Concept c) => c -> CodeExpr -> FuncStmt Source #
Define a declare-define statement.
fforRange :: (Quantity c, MayHaveUnit c, Concept 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, Concept 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.
packmod :: Name -> Description -> [Class] -> [Func] -> Mod Source #
Define a Mod with the given Name, Description, Classes, and Functions.
module Language.Drasil.Chunk.Code
data NamedArgument Source #
Any quantity can be a named argument (wrapper for DefinedQuantityDict),
but with more of a focus on generating code arguments.
Instances
| HasChunkRefs NamedArgument Source # | |||||
Defined in Language.Drasil.Chunk.NamedArgument Methods chunkRefs :: NamedArgument -> Set UID # | |||||
| HasUID NamedArgument Source # | Finds the | ||||
Defined in Language.Drasil.Chunk.NamedArgument Methods uid :: Getter NamedArgument UID # | |||||
| IsArgumentName NamedArgument Source # |
| ||||
Defined in Language.Drasil.Chunk.NamedArgument | |||||
| Idea NamedArgument Source # | Finds the idea contained in the | ||||
Defined in Language.Drasil.Chunk.NamedArgument Methods getA :: NamedArgument -> Maybe String # | |||||
| NamedIdea NamedArgument Source # | Finds the term ( | ||||
Defined in Language.Drasil.Chunk.NamedArgument Methods term :: Lens' NamedArgument NP # | |||||
| MayHaveUnit NamedArgument Source # | Finds the units of the | ||||
Defined in Language.Drasil.Chunk.NamedArgument Methods getUnit :: NamedArgument -> Maybe UnitDefn # | |||||
| Definition NamedArgument Source # | |||||
Defined in Language.Drasil.Chunk.NamedArgument Methods defn :: Lens' NamedArgument Sentence # | |||||
| HasSpace NamedArgument Source # | Finds the | ||||
Defined in Language.Drasil.Chunk.NamedArgument Methods typ :: Getter NamedArgument Space # | |||||
| HasSymbol NamedArgument Source # | Finds the | ||||
Defined in Language.Drasil.Chunk.NamedArgument Methods symbol :: NamedArgument -> Stage -> Symbol # | |||||
| Generic NamedArgument Source # | |||||
Defined in Language.Drasil.Chunk.NamedArgument Associated Types
| |||||
| Eq NamedArgument Source # | Equal if | ||||
Defined in Language.Drasil.Chunk.NamedArgument Methods (==) :: NamedArgument -> NamedArgument -> Bool # (/=) :: NamedArgument -> NamedArgument -> Bool # | |||||
| type Rep NamedArgument Source # | |||||
Defined in Language.Drasil.Chunk.NamedArgument type Rep NamedArgument = D1 ('MetaData "NamedArgument" "Language.Drasil.Chunk.NamedArgument" "drasil-code-0.1.9.0-96tSohZFYpYLbLPM7DzZV0" 'True) (C1 ('MetaCons "NA" 'PrefixI 'True) (S1 ('MetaSel ('Just "_qtd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DefinedQuantityDict))) | |||||
narg :: (Quantity q, MayHaveUnit q, Concept q) => q -> NamedArgument Source #
Smart constructor for NamedArgument .
module Language.Drasil.Data.ODEInfo