StreamCodeGenerator

de.uni_luebeck.isp.tessla.tessla_compiler.StreamCodeGenerator

Class containing functions for the translation of single TeSSLa stream expressions to imperative code

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def produceConstStepCode(id: Identifier, ot: TypeExpression, value: ExpressionOrRef, trigger: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = const(...) expression

Produces ImpLan code for a x = const(...) expression

Value parameters

currSrc

The source listing the generated block is added to. There is code attached to the stepSource section.

id

The id merge is assigned to

ot

Type of the output stream

trigger

Argument expression for triggering stream

value

Argument expressions for const value

Attributes

Returns

The modified source listing

Definition Classes
override def produceCountStepCode(id: Identifier, cntStream: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = count(...) expression

Produces ImpLan code for a x = count(...) expression

Value parameters

cntStream

Expression of the stream to be counted

currSrc

The source listing the generated block is added to. There is code attached to the stepSource section.

id

The id merge is assigned to

Attributes

Returns

The modified source listing

Definition Classes
override def produceDefaultFromStepCode(id: Identifier, ot: TypeExpression, stream: ExpressionOrRef, default: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = defaultFrom(...) expression

Produces ImpLan code for a x = defaultFrom(...) expression

Value parameters

currSrc

The source listing the generated block is added to. It is attached to the stepSource section of the source listing

default

The stream parameter of the defaultFrom

id

The id defaultFrom is assigned to

ot

The type of id. Must be Events[...]

stream

The stream parameter of the defaultFrom

Attributes

Returns

The modified source listing

Definition Classes
override def produceDefaultStepCode(id: Identifier, ot: TypeExpression, stream: ExpressionOrRef, defVal: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = default(...) expression

Produces ImpLan code for a x = default(...) expression

Value parameters

currSrc

The source listing the generated block is added to. It is attached to the stepSource section of the source listing

defVal

The default parameter of the default

id

The id default is assigned to

ot

The type of id. Must be Events[...]

stream

The stream parameter of the default

Attributes

Returns

The modified source listing

Definition Classes
override def produceDelayStepCode(id: Identifier, delay: ExpressionOrRef, reset: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = delay(...) expression

Produces ImpLan code for a x = delay(...) expression

Value parameters

currSrc

The source listing the generated block is added to. There is code attached to the tsGenSource and stepSource section.

delay

The delay-stream parameter of the delay

id

The id delay is assigned to

reset

The reset-stream parameter of the delay

Attributes

Returns

The modified source listing

Definition Classes
override def produceFilterStepCode(id: Identifier, ot: TypeExpression, value: ExpressionOrRef, condition: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = filter(...) expression

Produces ImpLan code for a x = filter(...) expression

Value parameters

condition

Argument expressions for filter condition stream

currSrc

The source listing the generated block is added to. There is code attached to the stepSource section.

id

The id merge is assigned to

ot

Type of the output stream

value

Argument expressions for filter value stream

Attributes

Returns

The modified source listing

Definition Classes
override def produceFoldStepCode(id: Identifier, ot: TypeExpression, stream: ExpressionOrRef, init: ExpressionOrRef, function: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = fold(...) expression

Produces ImpLan code for a x = fold(...) expression

Value parameters

currSrc

The source listing the generated block is added to. There is code attached to the stepSource section.

function

Expression of the function used for folding

id

The id merge is assigned to

init

Expression of the initial value for the folding

ot

Type of the output stream

stream

Expression of the stream to be folded

Attributes

Returns

The modified source listing

Definition Classes
override def produceInitializeStepCode(id: Identifier, ot: TypeExpression, defVal: ExpressionOrRef, currSrc: SourceListing): SourceListing

Attributes

Definition Classes
def produceInputFromAPICode(inStream: Identifier, typ: TypeExpression, currSrc: SourceListing): SourceListing

Produces code reading the std input (variable inputStream and value) and passes it to the _value variable of an input stream. For parsing the input string to an exact value a function [TC]inputParse is called which has to be translated in the following phases.

Produces code reading the std input (variable inputStream and value) and passes it to the _value variable of an input stream. For parsing the input string to an exact value a function [TC]inputParse is called which has to be translated in the following phases.

Value parameters

currSrc

The source listing the generated block is added to. There is code attached to the inputProcessing section.

inStream

The input stream to be handled

typ

The input stream's type. Must be Events[...].

Attributes

Returns

The modified source listing

def produceInputFromConsoleCode(inStream: Identifier, typ: TypeExpression, currSrc: SourceListing): SourceListing

Produces code reading the std input (variable inputStream and value) and passes it to the _value variable of an input stream. For parsing the input string to an exact value a function [TC]inputParse is called which has to be translated in the following phases.

Produces code reading the std input (variable inputStream and value) and passes it to the _value variable of an input stream. For parsing the input string to an exact value a function [TC]inputParse is called which has to be translated in the following phases.

Value parameters

currSrc

The source listing the generated block is added to. There is code attached to the inputProcessing section.

inStream

The input stream to be handled

typ

The input stream's type. Must be Events[...].

Attributes

Returns

The modified source listing

def produceInputUnchangeCode(inStream: Identifier, currSrc: SourceListing): SourceListing

Produces code resetting the changed flags of input variables.

Produces code resetting the changed flags of input variables.

Value parameters

currSrc

The source listing the generated block is added to. There is code attached to the tailSource section.

inStream

The inStream to be reseted.

Attributes

Returns

The modified source listing

override def produceLastStepCode(id: Identifier, ot: TypeExpression, values: ExpressionOrRef, clock: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = last(...) expression

Produces ImpLan code for a x = last(...) expression

Value parameters

clock

The trigger/clock-stream parameter of the last

currSrc

The source listing the generated block is added to. It is attached to the stepSource section of the source listing

id

The id last is assigned to

ot

The type of id. Must be Events[...]

values

The value-stream parameter of the last

Attributes

Returns

The modified source listing

Definition Classes
override def produceLiftStepCode(id: Identifier, ot: TypeExpression, args: Seq[ExpressionOrRef], function: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = lift(...) expression

Produces ImpLan code for a x = lift(...) expression

Value parameters

args

The arguments of the lift except the last one (function)

currSrc

The source listing the generated block is added to. There is code attached to the stepSource section.

function

The lifted function

id

The id lift is assigned to

ot

The type of id. Must be Events[...]

Attributes

Returns

The modified source listing

Definition Classes
override def produceMergeStepCode(id: Identifier, ot: TypeExpression, args: Seq[ExpressionOrRef], currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = merge(...) expression

Produces ImpLan code for a x = merge(...) expression

Value parameters

args

The stream expressions to be merged

currSrc

The source listing the generated block is added to. There is code attached to the stepSource section.

id

The id merge is assigned to

ot

The type of id. Must be Events[...]

Attributes

Returns

The modified source listing

Definition Classes
override def produceNativeFunctionStepCode(id: Identifier, ot: TypeExpression, name: String, args: Seq[ExpressionOrRef], typeArgs: Seq[TypeExpression], currSource: SourceListing): SourceListing

Produces code for a x = native:<name>(...) expression

Produces code for a x = native:<name>(...) expression

Value parameters

args

The arguments passed to e

currSource

The source listing where the generated code is attached to.

id

The id which is assigned (must be of stream type)

name

The function name which is applied with args and typeArgs and then assigned

ot

The Type of the output stream

typeArgs

The type arguments passed to e

Attributes

Returns

The modified source listing

Definition Classes
override def produceNilStepCode(id: Identifier, ot: TypeExpression, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = nil expression

Produces ImpLan code for a x = nil expression

Value parameters

currSrc

The source listing the generated block is added to. It is attached to the stepSource section of the source listing

id

The id nil is assigned to

ot

The type of id. Must be Events[...]

Attributes

Returns

The modified source listing

Definition Classes
def produceOutputToAPICode(id: Identifier, t: TypeExpression, nameOpt: Option[String], currSrc: SourceListing, raw: Boolean): SourceListing

Add code for output generation (calling of [TC]output) to the source listing. [TC]output gets value, error, timestamp passed and if the printing format is raw (i.e. only value, not the current timestamp) and has to be translated accordingly in the final code generation

Add code for output generation (calling of [TC]output) to the source listing. [TC]output gets value, error, timestamp passed and if the printing format is raw (i.e. only value, not the current timestamp) and has to be translated accordingly in the final code generation

Value parameters

currSrc

The source listing the generated block is added to. There is code attached to the tailSource section.

id

The id of the stream to be printed

nameOpt

The alias name of id for printing. Optional.

raw

If the output should be printed raw (without timestamp). Is passed to [TC]output.

t

id's type. Must be Events[...]

Attributes

Returns

The modified source listing

def produceOutputToConsoleCode(id: Identifier, t: TypeExpression, nameOpt: Option[String], currSrc: SourceListing, raw: Boolean): SourceListing

Add code for output generation (calling of [TC]output) to the source listing. [TC]output gets value, error, timestamp passed and if the printing format is raw (i.e. only value, not the current timestamp) and has to be translated accordingly in the final code generation

Add code for output generation (calling of [TC]output) to the source listing. [TC]output gets value, error, timestamp passed and if the printing format is raw (i.e. only value, not the current timestamp) and has to be translated accordingly in the final code generation

Value parameters

currSrc

The source listing the generated block is added to. There is code attached to the tailSource section.

id

The id of the stream to be printed

nameOpt

The alias name of id for printing. Optional.

raw

If the output should be printed raw (without timestamp). Is passed to [TC]output.

t

id's type. Must be Events[...]

Attributes

Returns

The modified source listing

override def producePureStepCode(id: Identifier, ot: TypeExpression, valStream: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = pure(...) expression

Produces ImpLan code for a x = pure(...) expression

Value parameters

currSrc

The source listing the generated block is added to. There is code attached to the stepSource section.

id

The id merge is assigned to

ot

Type of the output stream

valStream

Stream to be filtered

Attributes

Returns

The modified source listing

Definition Classes
override def produceReduceStepCode(id: Identifier, ot: TypeExpression, stream: ExpressionOrRef, function: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = reduce(...) expression

Produces ImpLan code for a x = reduce(...) expression

Value parameters

currSrc

The source listing the generated block is added to. There is code attached to the stepSource section.

function

Expression of the function used for reducing

id

The id merge is assigned to

ot

Type of the output stream

stream

Expression of the stream to be reduced

Attributes

Returns

The modified source listing

Definition Classes
override def produceSignalLiftStepCode(id: Identifier, ot: TypeExpression, args: Seq[ExpressionOrRef], function: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = slift(...) expression

Produces ImpLan code for a x = slift(...) expression

Value parameters

args

The arguments of the lift except the last one (function)

currSrc

The source listing the generated block is added to. There is code attached to the stepSource section.

function

The lifted function

id

The id slift is assigned to

ot

The type of id. Must be Events[...]

Attributes

Returns

The modified source listing

Definition Classes
override def produceTimeStepCode(id: Identifier, stream: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = time(...) expression

Produces ImpLan code for a x = time(...) expression

Value parameters

currSrc

The source listing the generated block is added to. It is attached to the stepSource section of the source listing

id

The id time is assigned to

stream

The base-stream parameter of the time

Attributes

Returns

The modified source listing

Definition Classes
override def produceUnitIfStepCode(id: Identifier, cond: ExpressionOrRef, currSrc: SourceListing): SourceListing

Produces ImpLan code for a x = unitIf(...) expression

Produces ImpLan code for a x = unitIf(...) expression

Value parameters

cond

Expression of the stream with the condition for unitIf

currSrc

The source listing the generated block is added to. There is code attached to the stepSource section.

id

The id merge is assigned to

Attributes

Returns

The modified source listing

Definition Classes

Inherited methods

final protected def externResolution(e: ExpressionOrRef, definitions: Map[Identifier, DefinitionExpression]): ExternExpression

Attributes

Inherited from:
StreamCodeGeneratorInterface
def translateExternSignalExpression(id: Identifier, e: ExternExpression, args: Seq[ExpressionOrRef], typeArgs: Seq[TypeExpression], currSource: SourceListing): ReturnType

Translates an assignment to a stream variable to the corresponding ImpLan Code and attaches it in a given source listing. The assigned expression has to be (and is always in TeSSLa Core) an application.

Translates an assignment to a stream variable to the corresponding ImpLan Code and attaches it in a given source listing. The assigned expression has to be (and is always in TeSSLa Core) an application.

Value parameters

args

The arguments passed to e

currSource

The source listing where the generated code is attached to. It is attached to the stepSource section of the source listing.

e

The expression which is applicated with args and typeArgs and then assigned

id

The id which is assigned (must be of stream type)

typeArgs

The type arguments passed to e

Attributes

Returns

The modified source listing

Inherited from:
StreamCodeGeneratorInterface
def translateStreamDefinitionExpression(id: Identifier, expression: DefinitionExpression, definitions: Map[Identifier, DefinitionExpression], currSrc: SourceListing): ReturnType

Translates a definition expression, which is always an assignment of an external signal application to a stream variable and attaches it in a given source collection.

Translates a definition expression, which is always an assignment of an external signal application to a stream variable and attaches it in a given source collection.

Value parameters

currSrc

The source listing where the generated code is attached to.

definitions

The map with all definition expressions

expression

The application expression

id

The id which is assigned (must be of stream type)

Attributes

Returns

The modified source listing

Inherited from:
StreamCodeGeneratorInterface