Skip to content

JS WAM: op/3 dynamic Pratt operator table - #4200

Open
s243a wants to merge 1 commit into
grok/wamjs-term-metafrom
grok/wamjs-op3
Open

JS WAM: op/3 dynamic Pratt operator table#4200
s243a wants to merge 1 commit into
grok/wamjs-term-metafrom
grok/wamjs-op3

Conversation

@s243a

@s243a s243a commented Aug 30, 2026

Copy link
Copy Markdown
Owner

G-W2 follow-up: the JS WAM Pratt reader now consults a live operator table so op/3 (and compile-time :- op/3 via javascript_wam_ops/1) can add or override ISO defaults.

What landed

  • Infix xfx / xfy / yfx, prefix fx / fy, postfix xf / yf
  • Priority 0 removes that specifier; name may be an atom or a list of atoms
  • ISO: infix and postfix of the same name cannot coexist; prefix may share a name with infix
  • Emit-time seed: javascript_wam_ops([op(P,T,N), ...]) (alias js_op_decls/1) → Runtime.install_declared_ops

Tests

  • probe_op3/0: custom infix + prefix + postfix + list-of-names, parsed with read_term_from_atom/2, matching SWI
  • emitted_op_decls: compile-time javascript_wam_ops([op(700, xfx, likes)]) without a runtime op/3 call

Branched from grok/wamjs-term-meta and extended it (net additions). No INTEGRATION_PATCH.md (no shared files).

Residuals

  • current_op/3 not implemented
  • Ops are process-global (like SWI), not module-local
Open in Web Open in Cursor 

Clone the ISO default infix/prefix tables into live copies that op/3
mutates (xfx/xfy/yfx, fx/fy, xf/yf; priority 0 removes). Compile-time
:- op/3 declarations seed the table via javascript_wam_ops/1.

Co-authored-by: johns243a <johns243a@gmail.com>
@s243a
s243a marked this pull request as ready for review August 30, 2026 18:22
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