General syntax
Reserved keywords
These reserved keywords are predefined reserved words with special meaning for the compiler. Apart from the mathematical functions and procedure functions there are some predefined words with special meaning to the compiler. The list of keywords is shown below.
array
double
else
end
exit
for
from
if
int
then
to
pi; reserved for the mathematical π≈3.14159...

Please be aware that in an expression, the typed “pi” represents a constant value, whereas the Greek symbol “π” serves as a variable parameter. Both will appear as “π” in the formatted expressions on the canvas, which may cause confusion.
Unit syntax
In DSE , you can give a parameter a unit, and this unit is formed by mixing basic units such as meters, seconds, kilograms, and Kelvin using only multiplication (*), division (/), and power (^) operations in an equation. To make sure the equation and any unit conversions stay simple, you’re not allowed to use addition or subtraction in it. Here are some examples of valid units:
m/s
kg* m/s^2
Apart from these base units you also have some unit combinations which have their own name and symbol. Lots of those are contained in the SI unit list and are also available in DSE to use in the parameter unit definition. Here are some examples of valid units using non base SI units:
N/m^2
L/s
Custom base units
Additionally, if DSE does not contain the unit which you want to use and/or it is not possible to define the unit with an equation with only multiplication (*), division (/), and power (^) operations you can define a custom user base unit. This can be done in the Units Manager window or from the unit popup window that you get when you edit a unit by clicking the Add a base unit button.
A custom user base unit definition usually contains an existing unit or units and some addition multiplication factor and a value shift. A simple custom user base unit definition follows the following format [factor] * or / [base unit or combined units] + or – [shift]. An example of a custom user base unit definition following this format and using existing units would be :
2*N*K/m+5
1/(m*Pa)-6
.
The exact rules for custom user base unit are:
- Unit symbols in the
[base unit or combined units]
section must be separated by either a multiplication (*
) or division (/
) operator. - Any number (factor, shift or power) in the unit text must be separated from the unit symbols with either a multiplication (
*
), division (/
), addition (+
) , subtraction (-
) or power (^
) operator
Each custom user base unit definition requires a symbol to associate with this unit. This unit can then be used in a parameter unit definition as usually. Here are some examples of valid custom user base units, their symbol and the possible unit symbol usage with parameters:
- light year; symbol
ly
ly= 9.4607×10^15*m
- Usage:
ly
- atmosphere; symbol
atm
atm = 1.013*10^5*Pa
- Usage:
atm
- calorie; symbol
cal
cal = 4.184*J
- Usage:
cal/kg
Prefixes
You can prefix any prefix-able unit symbol by typing one of the prefix symbols listed below directly in front of the unit symbol (without any spaces). Some of these default prefixes have been left out of Reves to decrease the amount of conflicts with potential custom units like imperial units.

Custom made unit are not automatically prefix-able with the symbols below to prevent the amount of possible unit symbol collisions. If a prefix-able custom unit is required, a new unit can be made using a conversion factor and the existing custom unit.
SI unit prefixes
Factor | Name | Symbol |
---|---|---|
1018 | exa | E |
1015 | peta | P |
1012 | tera | T |
109 | giga | G |
106 | mega | M |
103 | kilo | k |
102 | hecto | h |
101 | deka | da |
Factor | Name | Symbol |
---|---|---|
10-1 | deci | d |
10-2 | centi | c |
10-3 | milli | m |
10-6 | micro | µ |
10-9 | nano | n |
10-12 | pico | p |
Expression syntax
Symbols
Relational operators | ||
---|---|---|
= | x = y | x equals y |
> | x > y | x is larger than y |
< | x < y | x is less than y |
<= | x <= y | x is less than or equal to y |
>= | x >= y | x is greater than or equal to y |
<> | x <> y | x is not equal to y |
Mathematical operations | ||
+ | x + y | add y to x |
- | x - y | subtract y from x |
* | x * y | multiply y with x |
/ | x / y | divide x by y |
^ | x ^ y | raise x to the power y |
% | x % y | remainder of x divided by y |
Other functional symbols | ||
[ | x[index] | Take the item at index index when x is an array parameter |
] | x[index] | Take the item at index index when x is an array parameter |
( | (x + y) * z | These symbols help us group different expressions or numbers together |
) | (x + y) * z | Take the item at index index when x is an array parameter |
_ | x_y | Symbolic notation for subscripting y to x to get the notation: xy |
Other allowed non functional symbols are:
- Currency symbols
- !
- @
- #
- &
- { and }
- |
- ~
- `
- ;
- :
- “
- ‘
- ?
- \
Mathematical functions
Functions | ||
---|---|---|
abs | abs(x) | determines the absolute value of x |
arccos | arccos(x) | determines the angle(1) whose cosine is x |
arcsin | arcsin(x) | determines the angle(1) whose sine is x |
arctan | arctan(x) | determines the angle(1) whose tangent is x |
arctan2 | arctan2(y;x) | determines the angle angle(1) whose tangent is the quotient of y and x, where (x , y ) is a point in the Cartesian plane. |
besselJ | besselJ(n;x) | Returns the Bessel function J_n(x) for any real x and integer n ≥ 0. |
besselY | besselY(n;x) | Returns the Bessel function Y_n(x) for any positive x and integer n ≥ 0. |
ceiling | ceiling(x) | determines the smallest integer value greater or equal to the provided value x |
cos | cos(x) | determines the cosine of angle x (1) |
exp | exp(x) | determines e raised to the power of x |
floor | floor(x) | determines the largest integer value smaller or equal to the provided value x |
int | int(x) | converts x to an integer by rounding the number down to the nearest integer. Use it with array parameters to make the indexer explicitly an integer. |
integrate | integrate(f(x);x;a;b) | calculates the integral of f(x) from a to b with integrand x using the trapezoidal rule. In general this method of integration is faster with a slight loss of accuracy. The integrand cannot be a parameter. The lower (a) and upper (b) bound are allowed to be parameters. |
integrateMidpoint | integrateMidpoint(f(x);x;a;b) | calculates the integral of f(x) from a to b with integrand x using the midpoint rule. In general this method of integration is more accurate at the cost of speed. The integrand cannot be a parameter. The lower (a) and upper (b) bound are allowed to be parameters. |
length | length(x) | gets the length of parameter x. Use it with array parameters to get the length of the array. |
log | log(x) | determines the natural logarithm (ln, loge ) of x |
log10 | log10(x) | determines the base 10 logarithm of x |
max | max(x; y) | determines the larger value of x and y |
min | min(x; y) | determines the smaller value of x and y |
sin | sin(x) | determines the sinus of angle x (1) |
sqrt | sqrt(x) | determines the square root of x |
sum | sum(x) | gets the sum of the x values. Use it with array parameters to get the sum of all it’s indices. |
tan | tan(x) | determines the tangent of angle x (1) |
(1) Angle in radians.
Parameter syntax
An parameter symbol in an expression has to adhear to the following syntax rules:
It can:
- start with a underscore “_”.
- contain both upper case and lower case unicode letters. Case is significant.
- contain ‘letters’ from foreign scripts like greek, asian, arabic etc.
It cannot:
- start with a numeral.
- start with a symbol.
- contain a space.
- contain emoji’s
- contain symbols outside the allowed (operator) symbols
Procedure syntax
Procedure functions
Functions | ||
---|---|---|
array | array(length, val) | create and fill an array value item of length length with the value val at each index position |
Identifier
An identifier is an element in the code that is not a keyword, operator, or numeric value. An identifier is always associated with a value. An identifier has to follow the same syntax convention as parameters in expressions. In Reves DSE there are three kinds of identifiers: model parameters, the parameter to solve and local variables.
Model parameters
The parameters that are defined in the model can be used in a procedure as input parameters. The procedure will be executed with the known values of the used model parameter. To use a model parameter, simply type its symbol in the code box. When an parameter is recognized as a model parameter, it is highlighted in orange-red
.
The parameter to solve
The parameter to solve can either be an existing model parameter of a new parameter. In the last case this parameter to solve will also become a model parameters which is accessible outside of the procedure. When the code is executed the resulting value should be assigned to this parameter to enable the usage of this output value outside of the procedure.
Local variables
Local variables are identifiers that only exist within the procedure. They are mostly used to shorten and simplify the code. They are declared by writing the variable’s type and name. Variables defined in a control structure are only known inside that control structure.
Declare
// Declaring a variable called 'index', of type 'int'
int index
Initialize
Initialization of a declared variable is available by either of the following two methods.
// Declaring a variable called 'index', of type 'int' and initializing the variable immediately int index = 42
// Declaring a variable called 'index', of type 'int' and initializing the variable later
int index
index = 42
Control structures
if statement
The if statement is entered when the given condition is true.
Simple if statement without else-block:
if i > 0 then
// code performed if condition is met
...
end
If statement with else-block:
if i > 0 then
// code performed if condition is met
...
else
// code performed if condition is not met
...
end
If statement with else if-block and else-block:
if i < 10 then
// code performed if first condition is met
...
else if i > 100 then
// code performed if second condition is met
...
else
// code performed if both first and second condition are not met
...
end
for statement
The for loop is based on an iterator with is defined in three parts: declaration, start value (inclusive lower-bound) and end value (inclusive upper bound). The start and end values have to be integer values and can contain parameters or small equations. If the used value is not recognized as an integer it is possible to transform it to one using the integer function (int(x)
) . With each step of the loop, the iterator value is incremented with 1.
for i from 0 to 10
// code performed for each iteration
...
end
It is possible to stop a for loop before the end value of the iterator is reached. To do this, call exit
. Calling exit, will immediately stop the execution of the for loop.
for i from 0 to 10
...
if i > R1 then
exit
end
...
end
Code comments
Comments are marked by typing a double slash (//
). The double slash has to be the first character of the line (not counting spaces).
// a comment
double d1
Array syntax
For details on the array syntax it is best to view the related Array calculations syntax section.