Skip to content

Compile cli_args.pl through the JS WAM (A2) - #4208

Open
s243a wants to merge 3 commits into
grok/wamjs-profilingfrom
grok/wamjs-cli-args
Open

Compile cli_args.pl through the JS WAM (A2)#4208
s243a wants to merge 3 commits into
grok/wamjs-profilingfrom
grok/wamjs-cli-args

Conversation

@s243a

@s243a s243a commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Compile the frozen A1 peerhailer argparser (examples/cli_args/cli_args.pl) with the wam_javascript interpreter target and hold it to the same oracle bar as A1.

What

  • Import A1 examples/cli_args/ (oracle, harness, patternjs) from claude/peerhailer-exploratory-docs-aodas5. Top-level reference files are verbatim.
  • examples/cli_args/wamjs/: build.sh regenerates js/ from cli_args.pl; ESM shim cliArgs.mjs exports parseArgs / CliError (term conversion only); corpus copy cliArgs.wamjs.test.mjs; diff_runner_wamjs.mjs + run_differential_wamjs.sh.

Runtime gaps this program forced

  1. sub_string/5starts_with/2 and substring helpers call it; no user label, so the interpreter must implement the builtin (V.String Sub). Probe: probe_sub_string/0.
  2. Y-save across Calldefault_registry/1 is a huge ground fact (GetList/Unify*, no Allocate) and was clobbering the caller’s Y (including Result). Call snapshots Y; Proceed restores. Probe: probe_y_preserve/0.
  3. Execute of a builtin must Proceed, not halt — helpers such as substring_from/3 end with Deallocate+Execute sub_string/5. Halting dropped the rest of parse_args/3. Probe: probe_tail_builtin/0.

The shim implements no parse rule. /3 custom registries are converted at the edge; the 17-test corpus only uses /2 + the default registry.

Acceptance (measured)

  • bash examples/cli_args/wamjs/build.sh regenerates js/
  • node --test examples/cli_args/wamjs/cliArgs.wamjs.test.mjs17/17
  • Differential vs oracle, same seed:
sample size:          5067 argv-lines
  oracle ok results:  4150
  oracle errors:      917
divergences:          0
message mismatches:   0
timing: oracle 0.048s  wamjs 4.639s
  • tests/test_wam_javascript_builtins.pl (incl. the three new probes), lowered, fact-sources, and CONFORMANCE_TARGETS=javascript → green

Does not edit core/target_registry.pl, the conformance harness, wam_target.pl, or frozen examples/cli_args/ top-level files.

Open in Web Open in Cursor 

cursoragent and others added 3 commits September 1, 2026 01:54
Checked out from claude/peerhailer-exploratory-docs-aodas5. Top-level
reference and harness stay verbatim for the A2 JS-WAM compile.

Co-authored-by: johns243a <johns243a@gmail.com>
Interpreter-tier project under examples/cli_args/wamjs/, thin ESM shim,
oracle corpus + differential runner. Runtime: sub_string/5, Y-save across
Call, Execute-to-builtin proceeds to CP. Probes for each gap.

Co-authored-by: johns243a <johns243a@gmail.com>
Zero divergences vs the JS oracle; wamjs 4.639s vs oracle 0.048s.

Co-authored-by: johns243a <johns243a@gmail.com>
@s243a
s243a marked this pull request as ready for review September 1, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants