js: run a first conformance program under Node (step 2 of #63) #678

Closed
opened 2026-10-30 05:14:19 +00:00 by orion · 6 comments
Collaborator

Context

Step 2 of #63 (backend: JavaScript). Step 1 (#602, PR #606) landed docs/design/JAVASCRIPT-BACKEND.md; its section 6 names this as slice 1 of the implementation: the smallest slice that runs a real program under Node.

What

js: run a first conformance program under Node. Add Architecture.JavaScript to std/core and TargetArchitecture.JavaScript to project/target.trb, so that browser-js is a BuildTarget (everyTarget(), targetNamed, the tables of docs/tooling/torb-build.md); create compiler/src/backend/javascript/{emit,body,type,natives,writer}.trb and runtime/javascript/{core,int64}.mjs; emit the constructs of the slice-1 row of section 6 with the dispatch loop (Integer, Boolean, Void, records and tuples, Constant, Move, Copy, Branch, Jump, Return, Panic, TextConcat, PrintParts, ExitWithCode), the text of section 2.5 and the Int helpers of JAVASCRIPT-AND-PHP.md section 2a; make torb build, torb run and torb check accept the target without --emit-c; add tests/conformance/javascript_first.trb with its .expected and .exit files, tests/conformance/js.allow, tools/conformance.sh --js and the CI job conformance-js that installs Node 24.21.0 through .forgejo/actions/node.

Seed: touches it by name (a new Architecture case and target the build looks up), so expect two commits: the case of Architecture and the target first, the back end after; confirm with tools/check-commits.sh.

Out of scope: anything in the rows of slices 2 to 8 of section 6, a minifier, a source map, torb test. No slice adds a native to the kernel.

Acceptance criteria

  • torb build --target browser-js builds tests/conformance/javascript_first.trb (integers of every width with an overflow that panics, functions and recursion, a struct, print of text and numbers) and the output runs under Node
  • javascript_first.trb passes on the C, the VM and the JavaScript legs with the same expected files
  • js.allow holds it and the existing programs that use only the slice-1 constructs
  • CI job conformance-js with Node 24.21.0 runs tools/conformance.sh --js
  • torb format --check and torb docs check are green

Dependencies

  • Depends on #602 (closed, design record landed)

Part of the epic #63; the record docs/design/JAVASCRIPT-BACKEND.md section 6 is the specification.

## Context Step 2 of #63 (backend: JavaScript). Step 1 (#602, PR #606) landed `docs/design/JAVASCRIPT-BACKEND.md`; its section 6 names this as slice 1 of the implementation: the smallest slice that runs a real program under Node. ## What *js: run a first conformance program under Node.* Add `Architecture.JavaScript` to `std/core` and `TargetArchitecture.JavaScript` to `project/target.trb`, so that `browser-js` is a `BuildTarget` (`everyTarget()`, `targetNamed`, the tables of `docs/tooling/torb-build.md`); create `compiler/src/backend/javascript/{emit,body,type,natives,writer}.trb` and `runtime/javascript/{core,int64}.mjs`; emit the constructs of the slice-1 row of section 6 with the dispatch loop (`Integer`, `Boolean`, `Void`, records and tuples, `Constant`, `Move`, `Copy`, `Branch`, `Jump`, `Return`, `Panic`, `TextConcat`, `PrintParts`, `ExitWithCode`), the text of section 2.5 and the `Int` helpers of JAVASCRIPT-AND-PHP.md section 2a; make `torb build`, `torb run` and `torb check` accept the target without `--emit-c`; add `tests/conformance/javascript_first.trb` with its `.expected` and `.exit` files, `tests/conformance/js.allow`, `tools/conformance.sh --js` and the CI job `conformance-js` that installs Node 24.21.0 through `.forgejo/actions/node`. Seed: touches it by name (a new `Architecture` case and target the build looks up), so expect two commits: the case of `Architecture` and the target first, the back end after; confirm with `tools/check-commits.sh`. Out of scope: anything in the rows of slices 2 to 8 of section 6, a minifier, a source map, `torb test`. No slice adds a native to the kernel. ## Acceptance criteria - [ ] `torb build --target browser-js` builds `tests/conformance/javascript_first.trb` (integers of every width with an overflow that panics, functions and recursion, a struct, `print` of text and numbers) and the output runs under Node - [ ] `javascript_first.trb` passes on the C, the VM and the JavaScript legs with the same expected files - [ ] `js.allow` holds it and the existing programs that use only the slice-1 constructs - [ ] CI job `conformance-js` with Node 24.21.0 runs `tools/conformance.sh --js` - [ ] `torb format --check` and `torb docs check` are green ## Dependencies - Depends on #602 (closed, design record landed) _Part of the epic #63; the record `docs/design/JAVASCRIPT-BACKEND.md` section 6 is the specification._
Author
Collaborator

[loop:torbscript] ready: goal, acceptance criteria, design record (JAVASCRIPT-BACKEND.md section 6, slice 1) and seed impact (two commits) stated; one PR. No duplicate (keyword search: only #63 and #602).

[loop:torbscript] ready: goal, acceptance criteria, design record (JAVASCRIPT-BACKEND.md section 6, slice 1) and seed impact (two commits) stated; one PR. No duplicate (keyword search: only #63 and #602).
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261030 until 2026-10-30T11:15:00Z

[loop:torbscript] claim implement by session:loop-torbscript-20261030 until 2026-10-30T11:15:00Z
Author
Collaborator

[loop:torbscript] release implement: worker failed after 25 min (output overflow, no result); nothing pushed (no branch, no PR). Claim ended. next: respawn next tick with a narrower brief (keep the session output small; slice 1 only).

[loop:torbscript] release implement: worker failed after 25 min (output overflow, no result); nothing pushed (no branch, no PR). Claim ended. next: respawn next tick with a narrower brief (keep the session output small; slice 1 only).
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261030 @anthropic:theorben until 2026-10-30T12:00:00Z (respawn after a worker failure with no output; nothing was pushed)

[loop:torbscript] claim implement by session:loop-torbscript-20261030 @anthropic:theorben until 2026-10-30T12:00:00Z (respawn after a worker failure with no output; nothing was pushed)
Author
Collaborator

[loop:torbscript] release implement: PR #679 is open with CI green at head 13657e4a, and Argus is requested as reviewer. It has two commits: the browser-js target, and the emitter with runtime/javascript, the --js conformance mode and the conformance-js job. tests/conformance/javascript_first.trb ran under Node in CI and matched its expected output, including exit 101 and the panic position. Not exercised: torb run --target browser-js. Left for later slices: slices 2 to 8, the minifier, source maps and torb test on browser-js.
next: waiting (review of PR #679)

[loop:torbscript] release implement: PR #679 is open with CI green at head 13657e4a, and Argus is requested as reviewer. It has two commits: the browser-js target, and the emitter with runtime/javascript, the --js conformance mode and the conformance-js job. tests/conformance/javascript_first.trb ran under Node in CI and matched its expected output, including exit 101 and the panic position. Not exercised: torb run --target browser-js. Left for later slices: slices 2 to 8, the minifier, source maps and torb test on browser-js. next: waiting (review of PR #679)
Author
Collaborator

[loop:torbscript] done: PR #679 merged 2026-10-30T07:39Z; slice 1 is on main. Closing.

[loop:torbscript] done: PR #679 merged 2026-10-30T07:39Z; slice 1 is on main. Closing.
orion closed this issue 2026-10-30 07:50:13 +00:00
Sign in to join this conversation.
No labels
loop
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language#678
No description provided.