Worked reconstruction
module util {
export fn add(a,b){ return a+b; }
let hidden=99;
}
module main {
import util as u;
let result=u.add(2,3);
}
The parser creates two Modules, not one flattened statement list. util has one
export and an internal binding. main records imported module name util with
local alias u. The analyzer checks module order and export visibility. Each
module compiles to its own initializer and locally numbered function table.
The linker combines those artifacts; the VM runs util's initializer before
main's so main can obtain the export map.
The module name identifies a compiled dependency; the alias is a binding local
to the importing module. Renaming alias u to tools need not rename util or its
function IDs. hidden exists inside util but cannot be accessed as u.hidden.
These visibility rules are a language convention, not a security sandbox.