Evaluating

An expression becomes a program before it runs. Expressions describes its values. Compilation and execution determine how it runs. The native API accepts documents for the program and its input variables.

TRON371 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0043C 616765txt "age"
00802 24000000000000 00i64 36
0110F 0A 04000000 0800 0000map leaf, size 10: @4 → @8
01B4C 726F6C65txt "role"
0208C 656E67696E6565 72txt "engineer"
0290F 0A 1B000000 2000 0000map leaf, size 10: @1B → @20
0334C 6E616D65txt "name"
0383C 416461txt "Ada"
03C0F 0A 33000000 3800 0000map leaf, size 10: @33 → @38
04607 12 00910000 1100 0000 29000000 3C00 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @11 → @29 → @3C
0585C 236C696E6Btxt "#link"
05E5C 235F616461txt "#_ada"
0640F 0A 58000000 5E00 0000map leaf, size 10: @58 → @5E
06E3C 616765txt "age"
07202 29000000000000 00i64 41
07B0F 0A 6E000000 7200 0000map leaf, size 10: @6E → @72
0856C 6D656E746F72txt "mentor"
08C0F 0A 85000000 6400 0000map leaf, size 10: @85 → @64
0964C 726F6C65txt "role"
09B8C 656E67696E6565 72txt "engineer"
0A40F 0A 96000000 9B00 0000map leaf, size 10: @96 → @9B
0AE4C 6E616D65txt "name"
0B33C 426F62txt "Bob"
0B70F 0A AE000000 B300 0000map leaf, size 10: @AE → @B3
0C107 16 00990000 7B00 0000 8C000000 A400 0000 B7000000map branch, size 22, depth 0 (root), slots 8, 11, 12, 15: @7B → @8C → @A4 → @B7
0D73C 616765txt "age"
0DB02 1D000000000000 00i64 29
0E40F 0A D7000000 DB00 0000map leaf, size 10: @D7 → @DB
0EE4C 726F6C65txt "role"
0F38C 64657369676E65 72txt "designer"
0FC0F 0A EE000000 F300 0000map leaf, size 10: @EE → @F3
1064C 6E616D65txt "name"
10B2C 4379txt "Cy"
10E0F 0A 06010000 0B01 0000map leaf, size 10: @106 → @10B
11807 12 00910000 E400 0000 FC000000 0E01 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @E4 → @FC → @10E
12A4C 235F6379txt "#_cy"
12F0F 0A 2A010000 1801 0000map leaf, size 10: @12A → @118
1395C 235F626F62txt "#_bob"
13F0F 0A 39010000 C100 0000map leaf, size 10: @139 → @C1
1495C 235F616461txt "#_ada"
14F0F 0A 49010000 4600 0000map leaf, size 10: @149 → @46
15907 12 80210000 2F01 0000 3F010000 4F01 0000map branch, size 18, depth 0 (root), slots 7, 8, 13: @12F → @13F → @14F

Stored expressions

A stored expression has a title and an authored program document. Saving it validates compilation. A successful definition commit records its new revision. An inline program needs no database. Both forms use the same evaluator.

TRON47 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 2Btxt "+"
062C 3F78txt "?x"
0902 01000000000000 00i64 1
120E 15 00 0700 030000 00 04000000 060000 00 09000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @9
TRON21 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 2A000000000000 00i64 42

Maximum cost

The evaluation cost measures CPU time on the execution thread. The public API reports 100-nanosecond ticks. The cost limit uses the same unit. It includes input preparation, execution, native helpers and native result construction.

A positive limit permits execution until the evaluator detects that the budget is exhausted. Checks occur during execution and after result construction. A helper can cross the limit before the next check. Zero leaves a standalone evaluation without an explicit limit. Query budgets have additional rules in Bounds.

Errors

Compilation rejects an unknown operator or an invalid argument count. Evaluation rejects an invalid value type, arithmetic overflow or division by zero. The native diagnostic identifies the error and gives its explanation.

TRON53 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 2Ftxt "/"
0602 01000000000000 00i64 1
0F02 00000000000000 00i64 0
180E 15 00 0700 030000 00 04000000 060000 00 0F000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @F

Error

Runtime_Failure: The divisor must not be zero.

Run it

build · program evaluate.