Analysis

You are loading script files into the ScriptModule objects for preliminary static analysis of the script's code semantics and compilation into the Ad Astra Virtual Machine assembly.

let module = ScriptModule::new(
    Package::meta(),
    "let x = 10; x + 2; dbg(x);",
);

The first argument, Package::meta(), of the script module constructor is a reference to the metadata of the script package from which the script will be analyzed and interpreted.

The second argument is the script's source code, which you can load from a script file.

A script module is a mutable object that does not perform code analysis instantly. Instead, it provides interfaces to incrementally query certain features of the source code, in accordance with recent edits to the source text.