IntermediateCodeUtils

de.uni_luebeck.isp.tessla.tessla_compiler.IntermediateCodeUtils$
See theIntermediateCodeUtils companion class

Class containing a DSL for easy creation of ImpLanStmt-Blocks and other useful static methods for dealing ImpLan and the translation from TeSSLa

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

sealed trait DeclarationType

Represents the types of declared variables

Represents the types of declared variables

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
case object FinalDeclaration extends DeclarationType

Variable can be assigned and evaluated at declaration and is never changed again

Variable can be assigned and evaluated at declaration and is never changed again

Attributes

Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Self type

Variable can be assigned at declaration and is never changed again, the evaluation has to be lazy

Variable can be assigned at declaration and is never changed again, the evaluation has to be lazy

Attributes

Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Self type

The variable is reassigned in the generated code

The variable is reassigned in the generated code

Attributes

Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Self type

Value members

Concrete methods

Generates an addition expression

Generates an addition expression

Attributes

op1

First parameter sub-expression, must be of IntermediateCode.LongType

op2

Second parameter sub-expression, must be of IntermediateCode.LongType

Returns:

Addition expression

def And(ops: Seq[ImpLanExpr]): ImpLanExpr

Generates an and (&&) expression

Generates an and (&&) expression

Attributes

ops

parameter sub-expressions, must be of type IntermediateCode.BoolType

Returns:

And expression

Generates an bitor (|) expression

Generates an bitor (|) expression

Attributes

ops

parameter sub-expressions, must be of type IntermediateCode.LongType

Returns:

Or expression

def GetStruct(struct: ImpLanExpr, fieldName: String, structType: ImpLanType): ImpLanExpr

Produces an expression for accessing a structure field

Produces an expression for accessing a structure field

Attributes

fieldName

The accessed field name

struct

Expression which evaluates to a struct

structType

The type of the struct

Returns:

Expression accessing the struct

Generates a greater expression

Generates a greater expression

Attributes

a

First parameter sub-expression, must be of IntermediateCode.LongType

b

Second parameter sub-expression, must be of IntermediateCode.LongType

Returns:

Greater expression

Generates a greater equal expression

Generates a greater equal expression

Attributes

a

First parameter sub-expression, must be of IntermediateCode.LongType

b

Second parameter sub-expression, must be of IntermediateCode.LongType

Returns:

Greater equal expression

def MkStruct(content: Seq[(String, ImpLanExpr)], targetType: ImpLanType): ImpLanExpr

Produces an expression building a struct

Produces an expression building a struct

Attributes

content

Sub expressions with field names

targetType

The type of the struct to be generated

Returns:

Expression building a struct

Generates a negate expression

Generates a negate expression

Attributes

a

Sub-expression to be negated

Returns:

Negate expression

Generates a not equal expression

Generates a not equal expression

Attributes

a

First parameter sub-expression

b

Second parameter sub-expression

Returns:

Not equal expression

def Or(ops: Seq[ImpLanExpr]): ImpLanExpr

Generates an or (||) expression

Generates an or (||) expression

Attributes

ops

parameter sub-expressions, must be of type IntermediateCode.BoolType

Returns:

Or expression

Generates a subtraction expression

Generates a subtraction expression

Attributes

op1

First parameter sub-expression, must be of IntermediateCode.LongType

op2

Second parameter sub-expression, must be of IntermediateCode.LongType

Returns:

Subtraction expression

Generates a throw expression

Generates a throw expression

Attributes

e

sub expression of the error to be thrown, must be of IntermediateCode.ErrorType

forType

Type which should be returned inst

Returns:

Expression throwing an error

def defaultValueForStreamType(t: TypeExpression): Option[ImpLanVal]

Calculates a static default value for a stream type. For Events[t] it is the default value of t.

Calculates a static default value for a stream type. For Events[t] it is the default value of t.

Attributes

t

Type whose default value shall be determined. Must be Events[...]

Returns:

Default value for given type

def defaultValueForType(t: TypeExpression): Option[ImpLanVal]

Calculates a static default value for a non-stream type.

Calculates a static default value for a non-stream type.

Attributes

t

Type whose default value shall be determined. May not be Events[...]

Returns:

Default value for given type

def foldAST[A](exp: ImpLanExpr, n: A, f: (A, ImpLanExpr) => A, g: (A, ImpLanStmt) => A): A

Folds an IntermediateCode.ImpLanExpr including all sub-expressions and sub-statements. Sub-statements/sub-expressions are traversed prior their parent expressions

Folds an IntermediateCode.ImpLanExpr including all sub-expressions and sub-statements. Sub-statements/sub-expressions are traversed prior their parent expressions

Attributes

A

The result type of the folding operation

exp

The sequence of statements to be folded

f

Function executed on every expression

g

Function executed on every statement

n

The start value

Returns:

The result of the folding

def foldAST[A](stmts: Seq[ImpLanStmt], n: A, f: (A, ImpLanExpr) => A, g: (A, ImpLanStmt) => A): A

Folds a sequence of statements including all sub-expressions and sub-statements. Sub-statements/sub-expressions are traversed prior their parent expressions

Folds a sequence of statements including all sub-expressions and sub-statements. Sub-statements/sub-expressions are traversed prior their parent expressions

Attributes

A

The result type of the folding operation

f

Function executed on every expression

g

Function executed on every statement

n

The start value

stmts

The sequence of statements to be folded

Returns:

The result of the folding

def getVariableSeq(stmts: Seq[ImpLanStmt], baseSeq: Seq[(String, (ImpLanType, Option[ImpLanExpr], DeclarationType))], global: Boolean): Seq[(String, (ImpLanType, Option[ImpLanExpr], DeclarationType))]

Builds a sequence containing type/default/lazyness/global-definition information for all variables defined in stmts. If unsound information (e.g. multiple declarations) are found an error is thrown. The order is the one of the corresponding assignments.

Builds a sequence containing type/default/lazyness/global-definition information for all variables defined in stmts. If unsound information (e.g. multiple declarations) are found an error is thrown. The order is the one of the corresponding assignments.

Attributes

baseSeq

The base sequence to be extended

global

Include global definitions in sub-expressions (e.g. functions)

stmts

The sequence of statements to be examined

Returns:

Map containing variable information.

def mapAST(stmts: Seq[ImpLanStmt], f: ImpLanExpr => ImpLanExpr, g: ImpLanStmt => Option[ImpLanStmt]): Seq[ImpLanStmt]

Maps f on all subexpressions and g on all sub-statements of a sequence of statements

Maps f on all subexpressions and g on all sub-statements of a sequence of statements

Attributes

f

Function to map expressions

g

Function to map statements

stmts

The sequence of statements to be mapped

Returns:

Mapped sequence of statements

Maps f on all subexpressions and g on all sub-statements of an IntermediateCode.ImpLanExpr

Maps f on all subexpressions and g on all sub-statements of an IntermediateCode.ImpLanExpr

Attributes

exp

The expression to be mapped

f

Function to map expressions

g

Function to map statements

Returns:

Mapped expression

def structComparison(s1: String, s2: String): Boolean

Sorting function for structs taking care of the right sorting of tuple fild names

Sorting function for structs taking care of the right sorting of tuple fild names

Attributes

s1

First param for comparison

s2

Second param for comparison

Returns:

true if s1 <= s2 with respect to the special sorting rules

def structIsTuple(structType: StructType): Boolean

Figures out if a struct is a tuple. i.e. has field names _1,_2 ...

Figures out if a struct is a tuple. i.e. has field names _1,_2 ...

Attributes

structType

The struct to be examined

Returns:

Whether given struct is tuple

Implicits

Implicits

implicit def stringToVariable(str: String): Variable
implicit def typeConversion(t: TypeExpression): ImpLanType

Converts TeSSLa type to corresponding IntermediateCode.ImpLanType

Converts TeSSLa type to corresponding IntermediateCode.ImpLanType

Attributes

t

Type to be converted. If type is Events[t] the result is equal to calling the function with t.

Returns:

The converted type