Skip to content
Adrian edited this page Sep 13, 2021 · 1 revision

Syntax

Overview

The Syntax for the Parallel Pattern DSL starts with the basic module. It is important that the complete code is enclosed by curly brackets and the filename in the beginning. We will refer to this block as module.

filename {
...
}

A module contains multiple elements that are either Variables, Constants or Functions. To execute the module a main function is necessary. Functions are further divided into sequential functions and parallel patterns.

Module Inclusion

To include different modules one can utilize the keyword include followed by the path specification in quotation marks.

include "path/model"

Please make sure, that there are no name duplicates within functions, variables or constants across all included modules, since your code might not compile otherwise.

Data Types

There is a set of predefined data types natively supported by the Parallel Pattern DSL.

Lists

Lists are defined by enclosing data types in brackets []: [ Type ]

Primitive Types

  • Double : Double precision floating-point number
  • Float : Singe precision floating-point number
  • Int : 32 Bit Integer
  • Char : Character
  • Bool : Boolean (true, false)
  • String : String
  • Int8 : 8 Bit Integer
  • Int16 : 16 Bit Integer
  • Int32 : 32 Bit Integer (alias for Int./b>)
  • Int64 : 64 Bit Integer
  • UInt8 : 8 Bit unsigned Integer
  • UInt16 : 16 Bit unsigned Integer
  • UInt32 : 32 Bit unsigned Integer
  • UInt64 : 64 Bit unsigned Integer
  • Long : 64 Bit Integer (alias for Int64./b>)
  • Void : Untyped

Examples

  • [Int] : A list of 32 Bit Integers
  • [ [Int] ] : A list of lists of 32 Bit Integers

Variables

Declaration

Variables are defined with the keyword var, followed by the Type of the variable and its Name.

var Type Name

Instantiation

Optionally, it is possible set initial values for the Variable.

var Type Name = Expression

Examples

var Int x1 = -42//x1 is a 32 Bit Integer initialized with the value -42
var Char x2 = 'a'//x2 is a Character initialized with the value 'a'
var String x3 = "test"//x3 is a String initialized with the value "test"
var [Int] x4 = [1, 2, 3]//x3 is a list of Integers containing the Integers 1, 2 and 3

Variables can also be initialized by functions and can be changed within functions.