Skip to content

Expression Langauge

Matt Larsen edited this page Aug 25, 2019 · 14 revisions

Types

Integral Types

  • integer
  • double
  • mesh variables: strings, e.g. "pressure" indicate a variable defined on the mesh.
  • bool: Note: only produced as the result of a comparison. Not sure we need keywords true and false since I don't see how we would use it in practice.

Objects

Functions can return objects that contain values and attributes. Objects with values can be treated as just another value in an expression. Objects with only attributes must be manipulated with function calls to extract values.

Idea: currently, vector math, e.g. v1+v2 is implemented in the binary op code. Perhaps there is a way that we can define objects in such a way that it contains the code that defines supported ops like an overloaded operator in c++. In the near term, it is simpler to just add a add(vector,vector) function. Additionally, its unclear how we will generate code for JIT derived expressions.

Simple Objects: values only

  • Vector: a 3D vector created with the vector function, e.g., vector(0,1,0).

Complex Objects: might not have value.

  • Histogram: contains bin counts, min values, max values, bin deltas. Values are extracted via functions.

Operators

Binary Operators

  • Math: -, +, *, /, %
  • Comparison: ==, >=, <=, !=, >, <
  • Boolean: not implemented. We had the goal of being python like so maybe these should be and, or , and not, as opposed to &&, ||, and !. For JIT, we can just substitute whatever we need back in. Note: not is a unary operator.

Unary Operators

  • -

Clone this wiki locally