BackendInterface

de.uni_luebeck.isp.tessla.tessla_compiler.backends.BackendInterface
abstract class BackendInterface(sourceTemplate: String, userIncludes: String)

Abstract base class for the translation from intermediate code to real source code

Attributes

sourceTemplate

Resource path of the template code, where generated code is inserted

userIncludes

Additional user-specific code which is inserted at the //USERINCLUDES comment in the source template. Can be used e.g. for additional includes.

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Concise view

Value members

Abstract methods

def generateChunkCode(stmts: Seq[ImpLanStmt]): (String, String)

Translates a sequence of IntermediateCode.ImpLanStmt to the corresponding code in the target language. In difference to generateCode it splits the statements into groups of size chunkSize and creates an own method for each of them. This is useful for the generation of Scala code to give the JIT compiler better opportunities to optimize.

Translates a sequence of IntermediateCode.ImpLanStmt to the corresponding code in the target language. In difference to generateCode it splits the statements into groups of size chunkSize and creates an own method for each of them. This is useful for the generation of Scala code to give the JIT compiler better opportunities to optimize.

Attributes

stmts

The sequence of statements to be translated.

Returns:

Tuple with the chunk methods as first parameter and chunk method calls as second parameter.

def generateCode(stmts: Seq[ImpLanStmt]): String

Translates a sequence of IntermediateCode.ImpLanStmt to the corresponding code in the target language. Has to be implemented by Backend-Implementations.

Translates a sequence of IntermediateCode.ImpLanStmt to the corresponding code in the target language. Has to be implemented by Backend-Implementations.

Attributes

stmts

The sequence of statements to be translated.

Returns:

The generated code in the target language

def generateVariableDeclarations(vars: Seq[(String, (ImpLanType, Option[ImpLanExpr], DeclarationType))]): Seq[String]

Translates a set of variables with base information (type, default value, declaration type) to corresponding variable declarations in the target source code. Has to be implemented by Backend-Implementations.

Translates a set of variables with base information (type, default value, declaration type) to corresponding variable declarations in the target source code. Has to be implemented by Backend-Implementations.

Attributes

vars

Sequence of variables to be translated: Name -> (Type x Default value x Declaration type)

Returns:

Sequence of variable definitions

Concrete fields

protected val chunkSize: Int
val phase: TesslaPhase[SourceListing, String]

Phase from a IntermediateCode.SourceListing to real-world source code as String. Therefore the sections of the IntermediateCode.SourceListing are translated to code and included at special places of the template code by replacing

Phase from a IntermediateCode.SourceListing to real-world source code as String. Therefore the sections of the IntermediateCode.SourceListing are translated to code and included at special places of the template code by replacing

  • //VARDEF by a section where all used variables are defined
  • //TRIGGER by the translation of tsGenSource
  • //STEP by the translation of stepSource
  • //TAIL by the translation of tailSource
  • //INPUTPROCESSING by the translation of inputProcessing
  • //STATIC by the translation of staticSource

For more details on the requirements of the template see the markdown documents in doc

Attributes

orgListing

The source listing to be translated

Returns:

The source code of the generated monitor program

protected var variables: Seq[(String, (ImpLanType, Option[ImpLanExpr], DeclarationType))]