Theme
Supported Syntax and Expressions
This page serves as the complete formal reference for grammar, operators, functions, and validation rules accepted by Jupiter's expression parser. This syntax is shared across metrics, guard conditions, and parameter expressions.
Numerical Literals
- Decimal Notation: Use decimal digits with a period (
.) as the fraction delimiter:10,0.5,3.14159,.25. - Prohibited Syntax:
- Commas:
1,5is rejected with an unexpected token error. - Scientific Notation:
1e-5or2.5E+3are invalid. Write out full decimal values:0.00001.
- Commas:
Identifiers
Places (#PlaceName)
- The
#character prefixes references to Petri net places. - In guard conditions,
#Placeevaluates the instantaneous integer token count in that place. - In metrics,
#Placewithout braces is automatically treated as $E{\text{#Place}}$ (time average). - Examples:
#Queue,#InService,#Slots.
Parameters
- Must begin with a letter or underscore (
_), followed by letters, digits, or_:[a-zA-Z_][a-zA-Z0-9_]*. - Valid examples:
ARRIVAL_DELAY,NUM_WORKERS,rate_1. - Do not use accents, hyphens, or special punctuation.
Arithmetic Operators
| Operator | Description | Precedence | Associativity |
|---|---|---|---|
- (unary) | Sign negation | 1 (highest) | Right to left |
* | Multiplication | 2 | Left to right |
/ | Division | 2 | Left to right |
+ | Addition | 3 | Left to right |
- | Subtraction | 3 (lowest) | Left to right |
Parentheses ( ) have highest precedence and enforce evaluation order: (A + B) * C.
Relational and Comparison Operators
Used to construct boolean logic:
| Operator | Meaning | Example |
|---|---|---|
= or == | Equality | #Worker = 0, #Mode == 1 |
!= | Inequality | #Queue != 0 |
< | Less than | #Queue < CAPACITY |
<= | Less than or equal to | #Slots <= 0 |
> | Greater than | #Queue > 10 |
>= | Greater than or equal to | #Workers >= 2 |
Logical Operators
Used to combine boolean expressions:
| Operator | Meaning | Example |
|---|---|---|
NOT | Logical negation (inverts boolean value) | NOT (#Slots > 0) |
AND | Logical conjunction (true if both are true) | (#Queue > 0) AND (#Worker = 0) |
OR | Logical disjunction (true if at least one is true) | (#Error > 0) OR (#Timeout > 0) |
Parenthesize comparison sub-expressions when combining with logical operators.
Conditional Expressions (IF ... THEN ... ELSE)
The ternary conditional operator selects values based on boolean logic:
IF <condition> THEN <value_if_true> ELSE <value_if_false>- The
ELSEclause is mandatory. OmittingELSEcauses a syntax error. - Conditional clauses may be nested:
IF A > 10 THEN 100 ELSE IF A > 5 THEN 50 ELSE 0
Built-in Mathematical Functions
| Function | Arguments | Description | Example |
|---|---|---|---|
abs(x) | 1 number | Returns absolute value of $x$ | abs(E{#QueueA} - E{#QueueB}) |
min(a, b) | 2 numbers | Returns the lesser of $a$ and $b$ | min(E{#Queue}, LIMIT) |
max(a, b) | 2 numbers | Returns the greater of $a$ and $b$ | max(E{#Queue} - 5, 0) |
Temporal Integration Operators (Metrics Only)
| Operator | Scope | Description | Example |
|---|---|---|---|
E{ ... } | Mathematical expression | Expected value / time average integrated over the simulation duration | E{#Queue}, E{#Queue + #InService} |
P{ ... } | Boolean condition | Fraction of simulation time (between 0 and 1) during which the condition held true | P{#Slots = 0}, P{#Queue > 10} |
Feature Availability and Equivalents
| Desired Operation | Supported Natively? | Workaround in Jupiter |
|---|---|---|
| Exponentiation ($A^2$) | No | A * A |
| Modulo division | No | Not supported in current version |
| Square root | No | Not supported in current version |
Scientific notation (1e-6) | No | Write full decimal: 0.000001 |
| Percentage conversion | No | Multiply by 100: P{#Slots = 0} * 100 |
| Comma decimal separator | No | Use period: 0.5 |