DSL-Style state class for easy generation of ImpLan code. Functions of this class can be called iteratively to produce ImpLan step by step.
Attributes
- blockState
Stack keeping track of unclosed ifs/try-catchs
- condStack
Stack of conditions of if blocks which are not closed yet
- elseCatchStack
Stack of statements in Else/Catch blocks which are not closed yet
- ifTryStack
Stack of statements in If/Try blocks which are not closed yet
- stmts
Sequence of already generated statements
- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Add assignment to the code
Add assignment to the code
Attributes
- default
The default value the variable has until the assignment . Must match the default value from other assignments to this variable. Optional.
- lhs
The left hand side of the assignment
- rhs
The right hand side of the assignment
- typ
The type of the assigned identifier. Must match the type from other assignments to this variable.
- Returns:
IntermediateCodeUtils representing the new state
Add assignment to the code
Add assignment to the code
Attributes
- default
The default value the variable has until the assignment . Must match the default value from other assignments to this variable.
- lhs
The left hand side of the assignment
- rhs
The right hand side of the assignment
- typ
The type of the assigned identifier. Must match the type from other assignments to this variable.
- Returns:
IntermediateCodeUtils representing the new state
Add assignment to the code
Add assignment to the code
Attributes
- default
The default value the variable has until the assignment . Must match the default value from other assignments to this variable. Optional.
- glob
Whether the variable must be declared in the global space.
- lhs
The left hand side of the assignment
- rhs
The right hand side of the assignment
- typ
The type of the assigned identifier. Must match the type from other assignments to this variable.
- Returns:
IntermediateCodeUtils representing the new state
Closes the innermost try and starts its catch block. In the scope of the catch block a variable var_err exists which holds the thrown error. Fails if there was no previous unclosed try block.
Closes the innermost try and starts its catch block. In the scope of the catch block a variable var_err exists which holds the thrown error. Fails if there was no previous unclosed try block.
Attributes
- Returns:
IntermediateCodeUtils representing the new state
Closes the innermost if and starts its else block. Fails if there was no previous unclosed if block.
Closes the innermost if and starts its else block. Fails if there was no previous unclosed if block.
Attributes
- Returns:
IntermediateCodeUtils representing the new state
Closes the innermost if. Fails if there is none.
Closes the innermost if. Fails if there is none.
Attributes
- Returns:
IntermediateCodeUtils representing the new state
Closes the innermost try. Fails if there is none.
Closes the innermost try. Fails if there is none.
Attributes
- Returns:
IntermediateCodeUtils representing the new state
Add a final assignment to the code. May be called twice for the same lhs but only with exactly the same params.
Add a final assignment to the code. May be called twice for the same lhs but only with exactly the same params.
Attributes
- lazyDef
Flag indicating if the variable is of type lazy
- lhs
The left hand side of the assignment
- typ
The type of the assigned identifier.
- value
The value the variable has. Optional.
- Returns:
IntermediateCodeUtils representing the new state
Add a final assignment to the code. May be called twice for the same lhs but only with exactly the same params.
Add a final assignment to the code. May be called twice for the same lhs but only with exactly the same params.
Attributes
- lazyDef
Flag indicating if the variable is of type lazy
- lhs
The left hand side of the assignment
- typ
The type of the assigned identifier.
- value
The value the variable has. Optional. Note: Only in rare cases it makes sense to have a final assignment without value.
- Returns:
IntermediateCodeUtils representing the new state
Add a function call to the generated code.
Add a function call to the generated code.
Attributes
- name
The name of the function to be called
- params
The param expressions of the call
- typeHint
The type of the called function
- Returns:
IntermediateCodeUtils representing the new state
Adds an If statement to the code. Has to be closed with EndIf. Further generated statements are added inside the if.
Adds an If statement to the code. Has to be closed with EndIf. Further generated statements are added inside the if.
Attributes
- cond
The Ifs condition in DNF
- Returns:
IntermediateCodeUtils representing the new state
Add a lambda call to the generated code.
Add a lambda call to the generated code.
Attributes
- exp
The expression to be called
- params
The param expressions of the call
- Returns:
IntermediateCodeUtils representing the new state
Adds a Try statement to the code. Has to be followed by Catch and closed with EndTry. Further generated statements are added inside the try.
Adds a Try statement to the code. Has to be followed by Catch and closed with EndTry. Further generated statements are added inside the try.
Attributes
- Returns:
IntermediateCodeUtils representing the new state
Returns current statements. Checks if all if/trys are closed.
Returns current statements. Checks if all if/trys are closed.
Attributes
- Returns:
Sequence of statements from the current state