Skip to content

feat: JS compile target (--emit js, ES modules)#713

Merged
danieljohnmorris merged 1 commit into
mainfrom
feature/js-compile-target-mvp
May 22, 2026
Merged

feat: JS compile target (--emit js, ES modules)#713
danieljohnmorris merged 1 commit into
mainfrom
feature/js-compile-target-mvp

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

  • Adds src/codegen/js.rs mirroring python.rs — emits ES modules with const fn = (...args) => { ... } arrow functions
  • Wires --emit js flag in CLI alongside existing --emit python
  • Kebab-case names converted to camelCase (make-idmakeId)
  • Maps core builtins to JS equivalents: len.length, abs/min/max/flr/celMath.*, strString(), list spread for append, etc.
  • 12 unit tests pass; canonical fac/fib verified runnable in Node.js (fac(5)=120, fib(10)=55)

Deferred (follow-up tickets)

  • Result/Optional runtime helpers (_iloUnwrap is referenced but not emitted)
  • Full file I/O builtins (rd/wr/rdl/wrl — no Node fs bridge yet)
  • Tagged sum type pattern matching
  • Record best-effort mapping (currently emits plain objects with _type key, mirrors Python)
  • --emit js integration test in the CLI test harness
  • AOT/JIT path awareness

Test plan

  • cargo test codegen::js — 12/12 pass
  • ilo examples/recursion.ilo --emit js | node -e "$(cat); console.log(fac(5), fib(10))"120 55
  • ilo 'f x:n>n;*x 2' --emit js produces valid ES module

Closes ILO-73

🤖 Generated with Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@danieljohnmorris danieljohnmorris added the mini Created by mini PC autonomous workflow label May 22, 2026
Implements ILO-73 MVP: src/codegen/js.rs mirrors python.rs, wires
--emit js in CLI, and verifies fac/fib compile to runnable Node.js.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@danieljohnmorris danieljohnmorris force-pushed the feature/js-compile-target-mvp branch from 9c79adb to 9fd99c8 Compare May 22, 2026 09:03
@danieljohnmorris danieljohnmorris merged commit 49f501d into main May 22, 2026
1 of 10 checks passed
@danieljohnmorris danieljohnmorris deleted the feature/js-compile-target-mvp branch May 22, 2026 09:04
danieljohnmorris added a commit that referenced this pull request May 22, 2026
- Add --emit js / --emit python to CLI invocation section of SPEC.md (PR #713, ILO-73)
- Update tokcount entry: native uses tiktoken-rs cl100k_base BPE; WASM falls back to bytes/3.4 stub (PR #716, ILO-413)
- Add idxof builtin entry to SPEC.md builtins table (O n, code-point index, 0.13.0)
- Mirror all three fixes into skills/ilo/ilo-builtins-text.md
- Regenerate ai.txt via cargo build

Co-authored-by: Daniel Morris <daniel@cubitts.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mini Created by mini PC autonomous workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant