Expr

From CometPublic

Jump to: navigation, search

[edit] Overview

Expressions can be used on the right hand of the "<-" operator to assign and incremental value to an incremental variable. Example:

var{int} c(m) <- a + b;

Expressions are first class objects and can be directly manipulated:

expr{int} e = 2 * c - 5;

expr{int} e2 = c * c;

Then re-assigned to an incremental variable:

var{int} f(m) <- e * e2;

[edit] Basic Grammar for Expressions

  • "int"
  • NUM
  • "null"
  • "true"
  • "false"
  • STR
  • "IntToString" '(' Exp ')'
  • Exp '+' Exp
  • Exp '-' Exp
  • Exp '*' Exp
  • Exp '/' Exp
  • Exp '%' Exp
  • Exp "&&" Exp
  • Exp "||" Exp
  • Exp "=>" Exp
  • "!" Exp
  • '-' Exp
  • '+' Exp
  • "abs" '(' Exp ')'
  • "floor" '(' Exp ')'
  • TTROUND '(' Exp ')'
  • "ceil" '(' Exp ')'
  • "sqrt" '(' Exp ')'
  • "ln" '(' Exp ')'
  • Exp '^' Exp
  • Exp ".." Exp
  • Exp '>' Exp
  • Exp '<' Exp
  • Exp "==" Exp
  • Exp ">=" Exp
  • Exp "<=" Exp
  • Exp "!=" Exp
  • Exp '?' Exp ':' Exp
  • Exp "union" Exp
  • Exp "inter" Exp
  • Exp "cross" Exp
  • Exp "\" Exp // Set Minus
  • "member" '(' Exp ',' Exp ')'
  • Lvalue
  • '(' Exp ')'
  • "setof" '(' ArrayParamDecl ')' Exp
  • "all" '(' ListParamDecl ')' Exp
  • "prod" '(' ListParamDecl ')' Exp
  • "sum" '(' ListParamDecl ')' Exp
  • "and" '(' ListParamDecl ')' Exp
  • "or" '(' ListParamDecl ')' Exp
  • "max" '(' ListParamDecl ')' Exp
  • "argMax" '(' ParamDecl ')' Exp
  • "min" '(' ListParamDecl ')' Exp
  • "min" '(' Exp ',' Exp ')'
  • "max" '(' Exp ',' Exp ')'
  • "card" '(' Exp ')'
  • "argMin" '(' ParamDecl ')' Exp
  • '{' Exp '}'
  • '{' TwoOrMoreExp '}'
  • "lookahead" '(' Exp ',' Exp ')' Statement
  • "closure" Statement
  • "pclosure" Statement
  • "thread" Statement
  • "++" Lvalue
  • Lvalue "++"
  • "--" Lvalue
  • Lvalue "--"
  • Lvalue "instanceof" ID
  • '(' "int" ')' Exp
  • '(' "float" ')' Exp
  • '(' Exp ')' Lvalue
  • Exp "with" ID '(' Lvalue ')' Statement