Upcoming SlideShare
×

# Doppl development iteration #5

263 views

Published on

Doppl is a new programming language that aims providing a natural syntax for implementing parallel algorithms, designing data structures for shared memory applications and automated message passing among multiple tasks. The name is an abbreviation of `data oriented parallel programming language`.

Published in: Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
263
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
1
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Doppl development iteration #5

1. 1. DOPPL Data Oriented Parallel Programming Language Development Diary Iteration #5 Covered Concepts: Arithmetic, Relational and Binary Operators Diego PERINI Department of Computer Engineering Istanbul Technical University, Turkey 2013-07-26 1
2. 2. Abstract This paper stands for Doppl language development iteration #5. In this paper, basic operators to execute arithmetics, relations and binary operations (i.e shifting, bitwise logic) will be introduced. Previously introduced data types is used in the example source code. 1. Rationale As a high level language, Doppl uses arithmetic, relational and binary operators to compute low level calculations. These operators look nearly same with their other counterparts with a few exceptions. Each exception is explained in detail. 2. Arithmetic Operators To start with, Doppl makes use of six arithmetic operators to work with integers, floats and bytes. keyword meaning + addition - subtraction * multiplication // division with integer/byte result (floored) / division with float result % modulo +, -, *, % operators can operate on any pair of the same type and generate a result of the same type. // division operator on the other hand do only work on integers or bytes and generate a result of the same type. If the value generated cannot be represented as an integer, the value is floored. / operator always returns a float. % operator only works with integers and bytes. #Arithmetic operations task(1) Arithmetics { data a_byte = byte 2
3. 3. data an_int = int data a_float = float data another_int = int #will not be initialized #Examples init: { a_byte = 12 + 13 a_byte = 12 - 13 an_int = 12 * 13 an_int = 25 // 2 a_float = 25 / 2 an_int = 13 % 12 #25 #-1 which is converted into 0xFF #156 #12 floored from 12.5 #12.5 #1 #Below are invalid a_float = 25 // 2 #Calculation returns int or byte an_int = 12.0 + 13.0 #Type mismatch, see operator info an_int = a_float + a_byte #Type mismatch, see operator info an_int = another_int + 1 #Null data, value mismatch } } 3. Relational Operators Relational operators are special expressions that generate bool results that can be used to initialize boolean members as well as conditionally branch in a task (will be introduced later). keyword meaning < less than > greater than == equals != not equal <= less than or equal >= greater than or equal Implicit conversions are not allowed and each of these operators can only work with same type of parameters. Non-integral (i.e string) type behavior is not defined. 3
4. 4. #Relational operations task(1) Relations { data a_bool = bool #Examples init: { a_bool a_bool a_bool a_bool a_bool a_bool = = = = = = 2 < 3 2.5 > 0 1 == 1 1 != 1 15 >= 15 15 <= 14 #True #True #True #False #True #False a_bool = 1 == 1.0 #error, type mismatch } } 4. Binary Operators Binary operators are used to manipulate specific bits of values injectively. Below are the binary operators ordered by their precedence descendingly. keyword meaning & and | or ^ xor ! prefix not Like arithmetic operators, binary operators can only work on integral types. Unlike previously introduced operators, cross type usage is considered undefined behavior and should be avoided. #Binary operations task(1) Binary { data an_int = int data a_byte = byte #Examples init: { 4
5. 5. an_int an_int a_byte a_byte = = = = 0 | 0x00FF #0x00FF 1 & 0x00FF #0x00FF 0b00011111 ^ 0b11111000 #0b11100111 !0b00000001 #0b11111110 an_int = a_byte & an_int #error, undefined behavior } } It should be noted that there is no implicit type casting in Doppl therefore prefix not (!) does not yield a false when used on an integral value. 5. Conclusion Iteration #5 defines new operators to do arithmetic, relational and binary operations. Each of these operations can make use of parentheses to manipulate their order of precedence. 6. Future Concepts Below are the concepts that are likely to be introduced in next iterations. ● ● ● ● ● ● ● ● ● ● ● ● String Concatenation Standard input and output if conditional and trueness State transition operators Primitive Collections and basic collection operators Provision operators Tasks as members Task and data traits Custom data types and defining traits Built-in traits for primitive data types Message passing Exception states 7. License CC BY-SA 3.0 http://creativecommons.org/licenses/by-sa/3.0/ 5