Expressions and macros

An expression is a document. The example builds an expression program once and evaluates it with an input document. The macro example expands an expression before compilation and evaluation.

Example

Build an expression and evaluate it

expression_text holds this document:

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

input_text holds this document:

TRON33 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 78txt "x"
0602 29000000000000 00i64 41
0F0F 0A 04000000 0600 0000map leaf, size 10: @4 → @6
python228 B
async with (await stardust.parse(expression_text, "tron")) as expression, (await stardust.build(expression)) as program, \
        (await stardust.parse(input_text, "tron")) as input:
    result = (await program.evaluate(input))
TRON21 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 2A000000000000 00i64 42

Reusing programs

A program keeps the expression that you built, independently of any one evaluation.

  • You can evaluate one program concurrently with separate input documents.
  • Keep the program until its evaluations finish.
  • Then release it under the ownership rule of its operation.

Operations

OperationReturnsSummary
buildprogrambuild(expression) borrows the expression document and returns an owned program.
build_macroprogrambuild_macro(title, authored, arguments) binds AST arguments into an unstored macro and returns an owned program.
expand_macrodocumentexpand_macro(title, authored, arguments) returns the expanded expression document without building it.
Program.evaluatedocumentprogram.evaluate(input) returns an independent owned result document.
Program.closenoneRelease the program handle.
Database.expressionprogramBuild an owned program from a path or inline expression, expanding stored macros.

build

python79 B
def build(expression: Document, explain: BuildExplain | None = None) -> Program

Parameters

ParameterTypeOwnershipDefaultMeaning
expressionDocumentBorrowed for the callRequiredThe native expression AST to compile. The call borrows this document.
explainBuildExplain | NoneCaller-owned outputNoneOptional explain output. This record contains explain output for build.

Errors

StatusWhen
"compile_failed"the expression does not compile
"out_of_memory"native memory is exhausted

Notes

Expression documents.

Examples

Build an expression and evaluate its input

expression_text holds this document:

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

input_text holds this document:

TRON33 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 78txt "x"
0602 29000000000000 00i64 41
0F0F 0A 04000000 0600 0000map leaf, size 10: @4 → @6
python228 B
async with (await stardust.parse(expression_text, "tron")) as expression, (await stardust.build(expression)) as program, \
        (await stardust.parse(input_text, "tron")) as input:
    result = (await program.evaluate(input))
TRON21 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 2A000000000000 00i64 42

Inspect one measured cost stage

expression_text holds this document:

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
python179 B
explain = stardust.BuildExplain()
async with (await stardust.parse(expression_text, "tron")) as expression, (await stardust.build(expression, explain)):
    result = explain.total
TRON108 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
04BC 6172656E615F62 79746573txt "arena_bytes"
1002 00000000000000 00i64 0
190F 0A 04000000 1000 0000map leaf, size 10: @4 → @10
233C 637075txt "cpu"
2702 46000000000000 00i64 70
300F 0A 23000000 2700 0000map leaf, size 10: @23 → @27
3A4C 77616C6Ctxt "wall"
3F02 50000000000000 00i64 80
480F 0A 3A000000 3F00 0000map leaf, size 10: @3A → @3F
5207 12 21800000 1900 0000 30000000 4800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @19 → @30 → @48

Explain expression compilation

expression_text holds this document:

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
python173 B
explain = stardust.BuildExplain()
async with (await stardust.parse(expression_text, "tron")) as expression, (await stardust.build(expression, explain)):
    result = explain
TRON486 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
004BC 6172656E615F62 79746573txt "arena_bytes"
01002 00000000000000 00i64 0
0190F 0A 04000000 1000 0000map leaf, size 10: @4 → @10
0233C 637075txt "cpu"
02702 00000000000000 00i64 0
0300F 0A 23000000 2700 0000map leaf, size 10: @23 → @27
03A4C 77616C6Ctxt "wall"
03F02 0A000000000000 00i64 10
0480F 0A 3A000000 3F00 0000map leaf, size 10: @3A → @3F
05207 12 21800000 1900 0000 30000000 4800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @19 → @30 → @48
064BC 6172656E615F62 79746573txt "arena_bytes"
07002 00000000000000 00i64 0
0790F 0A 64000000 7000 0000map leaf, size 10: @64 → @70
0833C 637075txt "cpu"
08702 28000000000000 00i64 40
0900F 0A 83000000 8700 0000map leaf, size 10: @83 → @87
09A4C 77616C6Ctxt "wall"
09F02 28000000000000 00i64 40
0A80F 0A 9A000000 9F00 0000map leaf, size 10: @9A → @9F
0B207 12 21800000 7900 0000 90000000 A800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @79 → @90 → @A8
0C4BC 6172656E615F62 79746573txt "arena_bytes"
0D002 00000000000000 00i64 0
0D90F 0A C4000000 D000 0000map leaf, size 10: @C4 → @D0
0E33C 637075txt "cpu"
0E702 32000000000000 00i64 50
0F00F 0A E3000000 E700 0000map leaf, size 10: @E3 → @E7
0FA4C 77616C6Ctxt "wall"
0FF02 3C000000000000 00i64 60
1080F 0A FA000000 FF00 0000map leaf, size 10: @FA → @FF
11207 12 21800000 D900 0000 F0000000 0801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @D9 → @F0 → @108
12414 12 707265706172 655F657870726573 73696F6Etxt "prepare_expression"
1380F 0A 24010000 5200 0000map leaf, size 10: @124 → @52
1427C 636F6D70696C65txt "compile"
14A0F 0A 42010000 B200 0000map leaf, size 10: @142 → @B2
15414 10 737461676573 5F636F6D706C6574 6564txt "stages_completed"
16602 02000000000000 00i64 2
16F0F 0A 54010000 6601 0000map leaf, size 10: @154 → @166
179EC 6172656E615F63 61706163697479txt "arena_capacity"
18802 00000100000000 00i64 65536
1910F 0A 79010000 8801 0000map leaf, size 10: @179 → @188
19B5C 746F74616Ctxt "total"
1A10F 0A 9B010000 1201 0000map leaf, size 10: @19B → @112
1AB9C 63616368655F68 6974txt "cache_hit"
1B509bit true
1B60F 0A AB010000 B501 0000map leaf, size 10: @1AB → @1B5
1C007 1E D2480000 3801 0000 4A010000 6F01 0000 91010000 A101 0000 B6010000map branch, size 30, depth 0 (root), slots 1, 4, 6, 7, 11, 14: @138 → @14A → @16F → @191 → @1A1 → @1B6

C exports: stardust_expr_build, stardust_expr_program_error

build_macro

python79 B
def build_macro(title: str, authored: Document, arguments: Document) -> Program

Parameters

ParameterTypeOwnershipDefaultMeaning
titlestrValueRequiredThe diagnostic title of this unstored macro.
authoredDocumentBorrowed for the callRequiredThe native authored macro definition with its declared parameters and expression body.
argumentsDocumentBorrowed for the callRequiredNative AST arguments bound to the macro's declared parameters before expansion.

Errors

StatusWhen
"invalid_argument"the arguments include an undeclared macro parameter
"invalid_definition"the macro is invalid or expands recursively
"not_found"the macro refers to an unknown macro
"compile_failed"the expansion does not compile
"out_of_memory"native memory is exhausted

Notes

Macro documents.

Examples

Bind an unstored macro and evaluate it

macro_text holds this document:

TRON135 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
045C 696E707574txt "input"
0A0E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
176C 696E73657274txt "insert"
1E5C 696E707574txt "input"
240F 0A 17000000 1E00 0000map leaf, size 10: @17 → @1E
2E1C 2Btxt "+"
3002 01000000000000 00i64 1
390E 15 00 0700 030000 00 2E000000 240000 00 30000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2E → @24 → @30
4E6C 706172616D73txt "params"
550F 0A 4E000000 0A00 0000map leaf, size 10: @4E → @A
5F7C 657870616E6473txt "expands"
670F 0A 5F000000 3900 0000map leaf, size 10: @5F → @39
7107 0E 00050000 5500 0000 67000000map branch, size 14, depth 0 (root), slots 8, 10: @55 → @67

arguments_text holds this document:

TRON68 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 2Atxt "*"
067C 3F616D6F756E74txt "?amount"
0E02 02000000000000 00i64 2
170E 15 00 0700 030000 00 04000000 060000 00 0E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @E
2C5C 696E707574txt "input"
320F 0A 2C000000 1700 0000map leaf, size 10: @2C → @17

input_text holds this document:

TRON38 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
046C 616D6F756E74txt "amount"
0B02 0A000000000000 00i64 10
140F 0A 04000000 0B00 0000map leaf, size 10: @4 → @B
python325 B
async with (await stardust.parse(macro_text, "tron")) as authored, (await stardust.parse(arguments_text, "tron")) as arguments, \
        (await stardust.build_macro("twice-plus-one", authored, arguments)) as program, \
        (await stardust.parse(input_text, "tron")) as input:
    result = (await program.evaluate(input))
TRON21 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 15000000000000 00i64 21

C exports: stardust_macro_build, stardust_expr_program_error

expand_macro

python81 B
def expand_macro(title: str, authored: Document, arguments: Document) -> Document

Parameters

ParameterTypeOwnershipDefaultMeaning
titlestrValueRequiredThe diagnostic title of this unstored macro.
authoredDocumentBorrowed for the callRequiredThe native authored macro definition with its declared parameters and expression body.
argumentsDocumentBorrowed for the callRequiredNative AST arguments bound to the macro's declared parameters before expansion.

Errors

StatusWhen
"invalid_argument"the arguments include an undeclared macro parameter
"invalid_definition"the macro is invalid or expands recursively
"not_found"the macro refers to an unknown macro
"out_of_memory"native memory is exhausted

Notes

Macro documents.

Examples

Expand an unstored macro as a native document

macro_text holds this document:

TRON135 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
045C 696E707574txt "input"
0A0E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
176C 696E73657274txt "insert"
1E5C 696E707574txt "input"
240F 0A 17000000 1E00 0000map leaf, size 10: @17 → @1E
2E1C 2Btxt "+"
3002 01000000000000 00i64 1
390E 15 00 0700 030000 00 2E000000 240000 00 30000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2E → @24 → @30
4E6C 706172616D73txt "params"
550F 0A 4E000000 0A00 0000map leaf, size 10: @4E → @A
5F7C 657870616E6473txt "expands"
670F 0A 5F000000 3900 0000map leaf, size 10: @5F → @39
7107 0E 00050000 5500 0000 67000000map branch, size 14, depth 0 (root), slots 8, 10: @55 → @67

arguments_text holds this document:

TRON68 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 2Atxt "*"
067C 3F616D6F756E74txt "?amount"
0E02 02000000000000 00i64 2
170E 15 00 0700 030000 00 04000000 060000 00 0E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @E
2C5C 696E707574txt "input"
320F 0A 2C000000 1700 0000map leaf, size 10: @2C → @17
python209 B
async with (await stardust.parse(macro_text, "tron")) as authored, (await stardust.parse(arguments_text, "tron")) as arguments:
    result = (await stardust.expand_macro("twice-plus-one", authored, arguments))
TRON84 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 2Atxt "*"
067C 3F616D6F756E74txt "?amount"
0E02 02000000000000 00i64 2
170E 15 00 0700 030000 00 04000000 060000 00 0E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @E
2C1C 2Btxt "+"
2E02 01000000000000 00i64 1
370E 15 00 0700 030000 00 2C000000 170000 00 2E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2C → @17 → @2E

C exports: stardust_macro_expand, stardust_document_error

Program.evaluate

python97 B
def evaluate(self, input: Document | None = None, explain: EvalExplain | None = None) -> Document

Parameters

ParameterTypeOwnershipDefaultMeaning
selfProgramBorrowed for the callRequiredThe program owner for this operation. Keep it alive during the call.
inputDocument | NoneBorrowed for the callNoneVariables for evaluation. Absent input uses an empty object.
explainEvalExplain | NoneCaller-owned outputNoneOptional explain output. This record contains explain output for evaluate.

Errors

StatusWhen
"evaluation_failed"the expression fails on the input
"closed"the program is closed
"out_of_memory"native memory is exhausted

Notes

Expression evaluation.

Examples

Build an expression and evaluate its input

expression_text holds this document:

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

input_text holds this document:

TRON33 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 78txt "x"
0602 29000000000000 00i64 41
0F0F 0A 04000000 0600 0000map leaf, size 10: @4 → @6
python228 B
async with (await stardust.parse(expression_text, "tron")) as expression, (await stardust.build(expression)) as program, \
        (await stardust.parse(input_text, "tron")) as input:
    result = (await program.evaluate(input))
TRON21 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 2A000000000000 00i64 42

Explain expression evaluation

expression_text holds this document:

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

input_text holds this document:

TRON33 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 78txt "x"
0602 29000000000000 00i64 41
0F0F 0A 04000000 0600 0000map leaf, size 10: @4 → @6
python279 B
explain = stardust.EvalExplain()
async with (await stardust.parse(expression_text, "tron")) as expression, (await stardust.build(expression)) as program, \
        (await stardust.parse(input_text, "tron")) as input, (await program.evaluate(input, explain)):
    result = explain
TRON634 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
004BC 6172656E615F62 79746573txt "arena_bytes"
01002 00000000000000 00i64 0
0190F 0A 04000000 1000 0000map leaf, size 10: @4 → @10
0233C 637075txt "cpu"
02702 00000000000000 00i64 0
0300F 0A 23000000 2700 0000map leaf, size 10: @23 → @27
03A4C 77616C6Ctxt "wall"
03F02 0A000000000000 00i64 10
0480F 0A 3A000000 3F00 0000map leaf, size 10: @3A → @3F
05207 12 21800000 1900 0000 30000000 4800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @19 → @30 → @48
064BC 6172656E615F62 79746573txt "arena_bytes"
07002 00000000000000 00i64 0
0790F 0A 64000000 7000 0000map leaf, size 10: @64 → @70
0833C 637075txt "cpu"
08702 96000000000000 00i64 150
0900F 0A 83000000 8700 0000map leaf, size 10: @83 → @87
09A4C 77616C6Ctxt "wall"
09F02 96000000000000 00i64 150
0A80F 0A 9A000000 9F00 0000map leaf, size 10: @9A → @9F
0B207 12 21800000 7900 0000 90000000 A800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @79 → @90 → @A8
0C4BC 6172656E615F62 79746573txt "arena_bytes"
0D002 00000000000000 00i64 0
0D90F 0A C4000000 D000 0000map leaf, size 10: @C4 → @D0
0E33C 637075txt "cpu"
0E702 00000000000000 00i64 0
0F00F 0A E3000000 E700 0000map leaf, size 10: @E3 → @E7
0FA4C 77616C6Ctxt "wall"
0FF02 00000000000000 00i64 0
1080F 0A FA000000 FF00 0000map leaf, size 10: @FA → @FF
11207 12 21800000 D900 0000 F0000000 0801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @D9 → @F0 → @108
124BC 6172656E615F62 79746573txt "arena_bytes"
Show all 59 nodes
Offset (hex)Bytes (hex)Meaning
13002 00000000000000 00i64 0
1390F 0A 24010000 3001 0000map leaf, size 10: @124 → @130
1433C 637075txt "cpu"
14702 A0000000000000 00i64 160
1500F 0A 43010000 4701 0000map leaf, size 10: @143 → @147
15A4C 77616C6Ctxt "wall"
15F02 AA000000000000 00i64 170
1680F 0A 5A010000 5F01 0000map leaf, size 10: @15A → @15F
17207 12 21800000 3901 0000 50010000 6801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @139 → @150 → @168
184EC 646F63756D656E 745F6279746573txt "document_bytes"
19302 2A000000000000 00i64 42
19C0F 0A 84010000 9301 0000map leaf, size 10: @184 → @193
1A614 11 707265706172 655F766172696162 6C6573txt "prepare_variables"
1B90F 0A A6010000 5200 0000map leaf, size 10: @1A6 → @52
1C314 10 737461676573 5F636F6D706C6574 6564txt "stages_completed"
1D502 03000000000000 00i64 3
1DE0F 0A C3010000 D501 0000map leaf, size 10: @1C3 → @1D5
1E8EC 6172656E615F63 61706163697479txt "arena_capacity"
1F702 00000100000000 00i64 65536
2000F 0A E8010000 F701 0000map leaf, size 10: @1E8 → @1F7
20AEC 61646F70745F64 6F63756D656E74txt "adopt_document"
2190F 0A 0A020000 1201 0000map leaf, size 10: @20A → @112
22307 0E 14000000 0002 0000 19020000map branch, size 14, depth 1, slots 2, 4: @200 → @219
2318C 6576616C756174 65txt "evaluate"
23A0F 0A 31020000 B200 0000map leaf, size 10: @231 → @B2
2445C 746F74616Ctxt "total"
24A0F 0A 44020000 7201 0000map leaf, size 10: @244 → @172
25407 1E E20A0000 9C01 0000 B9010000 DE01 0000 23020000 3A02 0000 4A020000map branch, size 30, depth 0 (root), slots 1, 5, 6, 7, 9, 11: @19C → @1B9 → @1DE → @223 → @23A → @24A
Offset (hex)Bytes (hex)Meaning

C exports: stardust_expr_evaluate, stardust_result_take_document, stardust_result_error, stardust_result_release

Program.close

python23 B
def close(self) -> None

Consumes the receiver handle.

Parameters

ParameterTypeOwnershipDefaultMeaning
selfProgramConsumed ownerRequiredThe program owner to release. Do not use it after this call.

Examples

Build an expression and evaluate its input

expression_text holds this document:

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

input_text holds this document:

TRON33 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 78txt "x"
0602 29000000000000 00i64 41
0F0F 0A 04000000 0600 0000map leaf, size 10: @4 → @6
python228 B
async with (await stardust.parse(expression_text, "tron")) as expression, (await stardust.build(expression)) as program, \
        (await stardust.parse(input_text, "tron")) as input:
    result = (await program.evaluate(input))
TRON21 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 2A000000000000 00i64 42

C exports: stardust_expr_program_release

Database.expression

python92 B
def expression(self, source: str | Document, explain: BuildExplain | None = None) -> Program

Parameters

ParameterTypeOwnershipDefaultMeaning
selfDatabaseBorrowed for the callRequiredThe database owner for this operation. Keep it alive during the call.
sourcestr | DocumentValueRequiredAn inline native definition or a stored definition path.
explainBuildExplain | NoneCaller-owned outputNoneOptional explain output. This record contains explain output for build.

Errors

StatusWhen
"not_found"no expression is stored at the path
"invalid_definition"a macro it calls is invalid or expands recursively
"compile_failed"the expanded expression does not compile
"closed"the database is closed
"out_of_memory"native memory is exhausted

Notes

The program keeps the expression and macros selected at build time and survives database closure. Build again to use later definition changes.

Expression documents.

Examples

Build an expression with the database's macros and evaluate it

expression_text holds this document:

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

input_text holds this document:

TRON33 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 78txt "x"
0602 29000000000000 00i64 41
0F0F 0A 04000000 0600 0000map leaf, size 10: @4 → @6
python227 B
async with (await stardust.parse(expression_text, "tron")) as expression, (await db.expression(expression)) as program, \
        (await stardust.parse(input_text, "tron")) as input:
    result = (await program.evaluate(input))
TRON21 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 2A000000000000 00i64 42

C exports: stardust_db_expression_build, stardust_expr_program_error