Skip to main content

Operators

As described in the overview the language currently implements the following operators

  • Arithmetic Operators
  • Logical Operators
  • Relational Operators

Operator Specification

The list operators which have been implemented for each type in Binary and Unary are listed below

  • Binary Operators
    • Arithmetic
      • + Addition
      • - Substraction
      • * Multiplication
      • / Division
    • Logical
      • & And
      • | Or
    • Relational
      • == Equal To
      • != Not Equal To
      • > Greater Than
      • >= Greater Than Equal To
      • < Less Than
      • <= Less Than Equal To
  • Unary Operators
    • Arithmetic
      • - Negation
      • ++ increment
      • -- decrement
    • Logical
      • ! Not

Arithmetic Operators

consume fn printint(int val) void;

int k = 1000 + 101 * 90 + 60 / 20;

fn start() void {
int i = k + 10;
int m = -10;
int j = i - k + 101 + m;
printint(m++);
printint(j);
printint(--j);
return;
}

Relational Operators



int k = 1000 + 101 * 90 + 60 / 20;

fn start() void {
int i = k;

bool val = true;
bool val2 = false;

bool b = val == val2; # this will be false
bool c = i != k; # this will be false

bool d = i > k; # this will be false
bool e = i >= k; # this will be true

bool f = i < k; # this will be false
bool g = i <= k; # this will be true

return;
}

Logical Operators


fn start() void {
bool p = true;
bool q = false;

bool pANDq = p & q; # this will be false
bool pORq = p | q; # this will be true
bool NOTp = !p; # this will be false
bool NOTq = !q; # this will be true

bool NOTpORq = !pORq;
bool NOTpORNOTq = NOTp & NOTq;

bool deMorgan = NOTpORq == NOTpORNOTq; #This will be true,Hence proving the law

return;
}