![]() |
lingua-franca 0.10.1
Lingua Franca code generator
|
(EXPERIMENTAL) Generator for Uclid5 models. More...
Inherits org.lflang.generator.GeneratorBase.
Classes | |
| enum | Tactic |
| A tactic used to verify properties. More... | |
Public Member Functions | |
| void | doGenerate (Resource resource, LFGeneratorContext context) |
| Generate code from the Lingua Franca model contained by the specified resource. | |
| boolean | errorsOccurred () |
| Return true if errors occurred in the last call to doGenerate(). | |
| GeneratorCommandFactory | getCommandFactory () |
| Instantiation | getMainDef () |
| int | getReactionBankIndex (Reaction reaction) |
| Return the reaction bank index. | |
| Target | getTarget () |
| Return the Targets enum for the current target. | |
| TargetConfig | getTargetConfig () |
| TargetTypes | getTargetTypes () |
| void | printInfo (LFGeneratorContext context) |
| Print to stdout information about what source file is being generated, what mode the generator is in, and where the generated sources are to be put. | |
| void | reportCommandErrors (String stderr) |
| Parse the specified string for command errors that can be reported using marks in the Eclipse IDE. | |
| void | setReactionBankIndex (Reaction reaction, int bankIndex) |
| Mark the specified reaction to belong to only the specified bank index. | |
| UclidGenerator (LFGeneratorContext context, List< Attribute > properties) | |
| Constructor. | |
Public Attributes | |
| List< ActionInstance > | actionInstances = new ArrayList<ActionInstance>() |
| A list of action instances. | |
| final LFGeneratorContext | context |
| int | CT = 0 |
| Completeness threshold. | |
| Map< Path, String > | expectations = new HashMap<>() |
| List< Path > | generatedFiles = new ArrayList<>() |
| A list of paths to the uclid files generated. | |
| boolean | hasModalReactors = false |
| Indicates whether the current Lingua Franca program contains model reactors. | |
| boolean | hasWatchdogs = false |
| Indicates whether the program has any watchdogs. | |
| ReactorInstance | main |
| The main (top-level) reactor instance. | |
| MessageReporter | messageReporter |
| An error reporter for reporting any errors or warnings during the code generation. | |
| List< NamedInstance > | namedInstances |
| Path | outputDir |
| The directory where the generated files are placed. | |
| List< ReactionInstance.Runtime > | reactionInstances |
| A list of reaction runtime instances. | |
| UclidRunner | runner |
| A runner for the generated Uclid files. | |
| List< TriggerInstance > | triggerInstances |
| Joint lists of the lists above. | |
Protected Member Functions | |
| void | additionalPostProcessingForModes () |
| Hook for additional post-processing of the model. | |
| boolean | buildUsingDocker () |
| Create Dockerfiles and docker-compose.yml, build, and create a launcher. | |
| void | checkModalReactorSupport (boolean isSupported) |
| Checks whether modal reactors are present and require appropriate code generation. | |
| void | checkWatchdogSupport (boolean isSupported) |
| Check whether watchdogs are present and are supported. | |
| void | cleanIfNeeded (LFGeneratorContext context) |
| Check if a clean was requested from the standalone compiler and perform the clean step. | |
| void | copyUserFiles (TargetConfig targetConfig, FileConfig fileConfig) |
| Copy user specific files to the src-gen folder. | |
| void | createMainInstantiation () |
| If there is a main or federated reactor, then create a synthetic Instantiation for that top-level reactor and set the field mainDef to refer to it. | |
| void | generateActionAxioms () |
| Generate axiomatic semantics for actions. | |
| void | generateConnectionAxioms () |
| Generate axiomatic semantics for connections. | |
| void | generateControlBlock () |
| Uclid5 control block. | |
| void | generateInitialConditions () |
| Macros for initial conditions. | |
| void | generateProperty () |
| void | generateReactionAxioms () |
| Lift reaction bodies into Uclid axioms. | |
| void | generateReactionIdsAndStateVars () |
| Type definitions for runtime reaction Ids and state variables. | |
| void | generateReactionTriggerAxioms () |
| Axioms for encoding how reactions are triggered. | |
| void | generateReactorSemantics () |
| Axioms for reactor semantics. | |
| void | generateTimerAxioms () |
| Generate axiomatic semantics for timers. | |
| void | generateTimingSemantics () |
| Macros for timing semantics. | |
| void | generateTraceDefinition () |
| Macros, type definitions, and variable declarations for trace (path). | |
| void | generateTriggersAndReactions () |
| Axioms for all triggers. | |
| void | generateUclidCode () |
| The main function that generates Uclid code. | |
| void | generateUclidFile () |
| Generate the Uclid model. | |
| String | getConflictingConnectionsInModalReactorsBody (VarRef source, VarRef dest) |
| Return target code for forwarding reactions iff the connections have the same destination as other connections or reaction in mutually exclusive modes. | |
| DockerGenerator | getDockerGenerator (LFGeneratorContext context) |
| Return a DockerGenerator instance suitable for the target. | |
| ErrorFileAndLine | parseCommandOutput (String line) |
| Given a line of text from the output of a compiler, return an instance of ErrorFileAndLine if the line is recognized as the first line of an error message. | |
| void | registerTransformation (AstTransformation transformation) |
| Register an AST transformation to be applied to the AST. | |
| void | setReactorsAndInstantiationGraph (LFGeneratorContext.Mode mode) |
| Create a new instantiation graph. | |
Protected Attributes | |
| GeneratorCommandFactory | commandFactory |
| A factory for compiler commands. | |
| InstantiationGraph | instantiationGraph |
| Graph that tracks dependencies between instantiations. | |
| Instantiation | mainDef |
| Definition of the main (top-level) reactor. | |
| Map< Reaction, Integer > | reactionBankIndices = null |
| Map from reactions to bank indices. | |
| List< Reactor > | reactors = new ArrayList<>() |
| A list of Reactor definitions in the main resource, including non-main reactors defined in imported resources. | |
| final TargetConfig | targetConfig |
| The current target configuration. | |
(EXPERIMENTAL) Generator for Uclid5 models.
| org.lflang.analyses.uclid.UclidGenerator.UclidGenerator | ( | LFGeneratorContext | context, |
| List< Attribute > | properties ) |
Constructor.
|
protectedinherited |
Hook for additional post-processing of the model.
|
protectedinherited |
Create Dockerfiles and docker-compose.yml, build, and create a launcher.
|
protectedinherited |
Checks whether modal reactors are present and require appropriate code generation.
This will set the hasModalReactors variable.
| isSupported | indicates if modes are supported by this code generation. |
|
protectedinherited |
Check whether watchdogs are present and are supported.
| isSupported | indicates whether or not this is a supported target and whether or not it is a threaded runtime. |
|
protectedinherited |
Check if a clean was requested from the standalone compiler and perform the clean step.
|
protectedinherited |
Copy user specific files to the src-gen folder.
This should be overridden by the target generators.
| targetConfig | The targetConfig to read the files from. |
| fileConfig | The fileConfig used to make the copy and resolve paths. |
|
protectedinherited |
If there is a main or federated reactor, then create a synthetic Instantiation for that top-level reactor and set the field mainDef to refer to it.
| void org.lflang.analyses.uclid.UclidGenerator.doGenerate | ( | Resource | resource, |
| LFGeneratorContext | context ) |
Generate code from the Lingua Franca model contained by the specified resource.
This is the main entry point for code generation. This base class finds all reactor class definitions, including any reactors defined in imported .lf files (except any main reactors in those imported files), and adds them to the reactors list. If errors occur during generation, then a subsequent call to errorsOccurred() will return true.
| resource | The resource containing the source code. |
| context | Context relating to invocation of the code generator. In standalone mode, this object is also used to relay CLI arguments. |
Reimplemented from org.lflang.generator.GeneratorBase.
|
inherited |
Return true if errors occurred in the last call to doGenerate().
This will return true if any of the reportError methods was called.
|
protected |
Generate axiomatic semantics for actions.
|
protected |
Generate axiomatic semantics for connections.
|
protected |
Uclid5 control block.
|
protected |
Macros for initial conditions.
|
protected |
|
protected |
Lift reaction bodies into Uclid axioms.
|
protected |
Type definitions for runtime reaction Ids and state variables.
|
protected |
Axioms for encoding how reactions are triggered.
|
protected |
Axioms for reactor semantics.
|
protected |
Generate axiomatic semantics for timers.
|
protected |
Macros for timing semantics.
|
protected |
Macros, type definitions, and variable declarations for trace (path).
|
protected |
Axioms for all triggers.
|
protected |
The main function that generates Uclid code.
|
protected |
Generate the Uclid model.
|
inherited |
|
protectedinherited |
Return target code for forwarding reactions iff the connections have the same destination as other connections or reaction in mutually exclusive modes.
This method needs to be overridden in target specific code generators that support modal reactors.
|
protected |
Return a DockerGenerator instance suitable for the target.
Reimplemented from org.lflang.generator.GeneratorBase.
|
inherited |
|
inherited |
Return the reaction bank index.
| reaction | The reaction. |
| Target org.lflang.analyses.uclid.UclidGenerator.getTarget | ( | ) |
Return the Targets enum for the current target.
Reimplemented from org.lflang.generator.GeneratorBase.
|
inherited |
| TargetTypes org.lflang.analyses.uclid.UclidGenerator.getTargetTypes | ( | ) |
Reimplemented from org.lflang.generator.GeneratorBase.
|
protectedinherited |
Given a line of text from the output of a compiler, return an instance of ErrorFileAndLine if the line is recognized as the first line of an error message.
Otherwise, return null. This base class simply returns null.
| line | A line of output from a compiler or other external tool that might generate errors. |
|
inherited |
Print to stdout information about what source file is being generated, what mode the generator is in, and where the generated sources are to be put.
|
protectedinherited |
Register an AST transformation to be applied to the AST.
The transformations will be applied in the order that they are registered in.
|
inherited |
Parse the specified string for command errors that can be reported using marks in the Eclipse IDE.
In this class, we attempt to parse the messages to look for file and line information, thereby generating marks on the appropriate lines. This should not be called in standalone mode.
| stderr | The output on standard error of executing a command. |
|
inherited |
Mark the specified reaction to belong to only the specified bank index.
This is needed because reactions cannot declare a specific bank index as an effect or trigger. Reactions that send messages between federates, including absent messages, need to be specific to a bank member.
| reaction | The reaction. |
| bankIndex | The bank index, or -1 if there is no bank. |
|
protectedinherited |
Create a new instantiation graph.
This is a graph where each node is a Reactor (not a ReactorInstance) and an arc from Reactor A to Reactor B means that B contains an instance of A, constructed with a statement like a = new A(); After creating the graph, sort the reactors in topological order and assign them to the reactors class variable. Hence, after this method returns, this.reactors will be a list of Reactors such that any reactor is preceded in the list by reactors that it instantiates.
| List<ActionInstance> org.lflang.analyses.uclid.UclidGenerator.actionInstances = new ArrayList<ActionInstance>() |
A list of action instances.
|
protectedinherited |
A factory for compiler commands.
|
inherited |
| int org.lflang.analyses.uclid.UclidGenerator.CT = 0 |
Completeness threshold.
| Map<Path, String> org.lflang.analyses.uclid.UclidGenerator.expectations = new HashMap<>() |
| List<Path> org.lflang.analyses.uclid.UclidGenerator.generatedFiles = new ArrayList<>() |
A list of paths to the uclid files generated.
|
inherited |
Indicates whether the current Lingua Franca program contains model reactors.
|
inherited |
Indicates whether the program has any watchdogs.
This is used to check for support.
|
protectedinherited |
Graph that tracks dependencies between instantiations.
This is a graph where each node is a Reactor (not a ReactorInstance) and an arc from Reactor A to Reactor B means that B contains an instance of A, constructed with a statement like a = new A(); After creating the graph, sort the reactors in topological order and assign them to the reactors class variable. Hence, after this method returns, this.reactors will be a list of Reactors such that any reactor is preceded in the list by reactors that it instantiates.
|
inherited |
The main (top-level) reactor instance.
|
protectedinherited |
Definition of the main (top-level) reactor.
This is an automatically generated AST node for the top-level reactor.
|
inherited |
An error reporter for reporting any errors or warnings during the code generation.
| List<NamedInstance> org.lflang.analyses.uclid.UclidGenerator.namedInstances |
| Path org.lflang.analyses.uclid.UclidGenerator.outputDir |
The directory where the generated files are placed.
|
protectedinherited |
Map from reactions to bank indices.
| List<ReactionInstance.Runtime> org.lflang.analyses.uclid.UclidGenerator.reactionInstances |
A list of reaction runtime instances.
|
protectedinherited |
A list of Reactor definitions in the main resource, including non-main reactors defined in imported resources.
These are ordered in the list in such a way that each reactor is preceded by any reactor that it instantiates using a command like foo = new Foo();
| UclidRunner org.lflang.analyses.uclid.UclidGenerator.runner |
A runner for the generated Uclid files.
|
protectedinherited |
The current target configuration.
| List<TriggerInstance> org.lflang.analyses.uclid.UclidGenerator.triggerInstances |
Joint lists of the lists above.