Skip to content

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,5 is rejected with an unexpected token error.
    • Scientific Notation: 1e-5 or 2.5E+3 are invalid. Write out full decimal values: 0.00001.

Identifiers ​

Places (#PlaceName) ​

  • The # character prefixes references to Petri net places.
  • In guard conditions, #Place evaluates the instantaneous integer token count in that place.
  • In metrics, #Place without 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 ​

OperatorDescriptionPrecedenceAssociativity
- (unary)Sign negation1 (highest)Right to left
*Multiplication2Left to right
/Division2Left to right
+Addition3Left to right
-Subtraction3 (lowest)Left to right

Parentheses ( ) have highest precedence and enforce evaluation order: (A + B) * C.


Relational and Comparison Operators ​

Used to construct boolean logic:

OperatorMeaningExample
= 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:

OperatorMeaningExample
NOTLogical negation (inverts boolean value)NOT (#Slots > 0)
ANDLogical conjunction (true if both are true)(#Queue > 0) AND (#Worker = 0)
ORLogical 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 ELSE clause is mandatory. Omitting ELSE causes 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 ​

FunctionArgumentsDescriptionExample
abs(x)1 numberReturns absolute value of $x$abs(E{#QueueA} - E{#QueueB})
min(a, b)2 numbersReturns the lesser of $a$ and $b$min(E{#Queue}, LIMIT)
max(a, b)2 numbersReturns the greater of $a$ and $b$max(E{#Queue} - 5, 0)

Temporal Integration Operators (Metrics Only) ​

OperatorScopeDescriptionExample
E{ ... }Mathematical expressionExpected value / time average integrated over the simulation durationE{#Queue}, E{#Queue + #InService}
P{ ... }Boolean conditionFraction of simulation time (between 0 and 1) during which the condition held trueP{#Slots = 0}, P{#Queue > 10}

Feature Availability and Equivalents ​

Desired OperationSupported Natively?Workaround in Jupiter
Exponentiation ($A^2$)NoA * A
Modulo divisionNoNot supported in current version
Square rootNoNot supported in current version
Scientific notation (1e-6)NoWrite full decimal: 0.000001
Percentage conversionNoMultiply by 100: P{#Slots = 0} * 100
Comma decimal separatorNoUse period: 0.5