de.uni_luebeck.isp.tessla.tessla_compiler
IntermediateCodeUtils
Companion object IntermediateCodeUtils
class IntermediateCodeUtils extends AnyRef
DSL-Style state class for easy generation of ImpLan code. Functions of this class can be called iteratively to produce ImpLan step by step.
- Alphabetic
- By Inheritance
- IntermediateCodeUtils
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new IntermediateCodeUtils(stmts: Seq[ImpLanStmt], blockState: Seq[BlockState] = Seq(Out), ifTryStack: Seq[Seq[ImpLanStmt]] = Seq(), elseCatchStack: Seq[Seq[ImpLanStmt]] = Seq(), condStack: Seq[Seq[Seq[ImpLanExpr]]] = Seq())
- stmts
Sequence of already generated statements
- blockState
Stack keeping track of unclosed ifs/try-catchs
- ifTryStack
Stack of statements in If/Try blocks which are not closed yet
- elseCatchStack
Stack of statements in Else/Catch blocks which are not closed yet
- condStack
Stack of conditions of if blocks which are not closed yet
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def Assignment(lhs: Variable, rhs: ImpLanExpr, default: Option[ImpLanExpr], typ: ImpLanType): IntermediateCodeUtils
Add assignment to the code
Add assignment to the code
- lhs
The left hand side of the assignment
- rhs
The right hand side of the assignment
- default
The default value the variable has until the assignment . Must match the default value from other assignments to this variable. Optional.
- typ
The type of the assigned identifier. Must match the type from other assignments to this variable.
- returns
IntermediateCodeUtils representing the new state
- def Assignment(lhs: Variable, rhs: ImpLanExpr, default: ImpLanExpr, typ: ImpLanType): IntermediateCodeUtils
Add assignment to the code
Add assignment to the code
- lhs
The left hand side of the assignment
- rhs
The right hand side of the assignment
- default
The default value the variable has until the assignment . Must match the default value from other assignments to this variable.
- typ
The type of the assigned identifier. Must match the type from other assignments to this variable.
- returns
IntermediateCodeUtils representing the new state
- def Catch(): IntermediateCodeUtils
Closes the innermost try and starts its catch 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.
- returns
IntermediateCodeUtils representing the new state
- def Else(): IntermediateCodeUtils
Closes the innermost if and starts its else block.
Closes the innermost if and starts its else block. Fails if there was no previous unclosed if block.
- returns
IntermediateCodeUtils representing the new state
- def EndIf(): IntermediateCodeUtils
Closes the innermost if.
Closes the innermost if. Fails if there is none.
- returns
IntermediateCodeUtils representing the new state
- def EndTry(): IntermediateCodeUtils
Closes the innermost try.
Closes the innermost try. Fails if there is none.
- returns
IntermediateCodeUtils representing the new state
- def FinalAssignment(lhs: Variable, default: ImpLanVal, typ: ImpLanType, lazyDef: Boolean = false): IntermediateCodeUtils
Add a final assignment to the code.
Add a final assignment to the code. May be called twice for the same lhs but only with exactly the same params.
- lhs
The left hand side of the assignment
- default
The value the variable has.
- typ
The type of the assigned identifier.
- lazyDef
Flag indicating if the variable is of type lazy
- returns
IntermediateCodeUtils representing the new state
- def FunctionCall(name: String, params: Seq[ImpLanExpr], typeHint: FunctionType): IntermediateCodeUtils
Add a function call to the generated code.
Add a function call to the generated code.
- 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
- def If(cond: Seq[Seq[ImpLanExpr]]): IntermediateCodeUtils
Adds an If statement to the code.
Adds an If statement to the code. Has to be closed with EndIf. Further generated statements are added inside the if.
- cond
The Ifs condition in DNF
- returns
IntermediateCodeUtils representing the new state
- def LambdaApplication(exp: ImpLanExpr, params: Seq[ImpLanExpr]): IntermediateCodeUtils
Add a lambda call to the generated code.
Add a lambda call to the generated code.
- exp
The expression to be called
- params
The param expressions of the call
- returns
IntermediateCodeUtils representing the new state
- def Try(): IntermediateCodeUtils
Adds a Try statement to the code.
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.
- returns
IntermediateCodeUtils representing the new state
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def generateStatements: Seq[ImpLanStmt]
Returns current statements.
Returns current statements. Checks if all if/trys are closed.
- returns
Sequence of statements from the current state
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated