Skip to content

Transpile

Compile an ilo program to JavaScript or Python source. Use this when you need to run ilo logic in a JS or Python runtime — browser, Node, embedded Python, or any non-ilo host.

Shell
ilo build file.@ --emit js -o file.js # ES module
ilo build file.@ --emit python -o file.py # Python 3.8+

Same ilo build subcommand as the native AOT path; the --emit flag chooses the target.

  • JS: ES module with arrow-function bodies, kebab-case → camelCase rename (make-idmakeId), Result encoded as ["ok", v] / ["err", e] tuples, records as plain objects with _type key. Builtin mapping: len.length, abs/min/max/flr/cel/sqrtMath.*, prntconsole.log, jdmp/jparJSON.stringify/parse, rndMath.random(), list append → spread.
  • Python: idiomatic Python 3 source with type hints. Same Result-as-tuple shape. Records as @dataclass.

The transpiled output is not a full ilo runtime — it covers the canonical surface (functions, prefix expressions, guards, match, Result, records, lists, maps, common builtins). Features that don’t have a clean host equivalent are deferred:

  • JS: file I/O, defer/errdefer, World/capabilities, tagged sum-type match patterns, generic monomorphisation (best-effort), full builtin coverage
  • Python: pattern-match arms that depend on ilo-specific match semantics, World/capabilities

For production code that needs full ilo semantics, ship the native binary (ilo build) or run via JIT (ilo run --jit).

Use caseReach for
Browser script--emit js
Existing Python codebase calling ilo--emit python
Cross-platform native binarynative AOT (no --emit)
Hot numeric loop on the serverilo run --jit
One-off CLI invocationilo run
  • ilo build — native AOT compile (default target)
  • Engines reference — VM, JIT, AOT comparison