Skip to content

feat(wam-clojure): add lowered emitter scaffold#1703

Merged
s243a merged 1 commit intomainfrom
feat/wam-clojure-lowered-emitter-scaffold
Apr 29, 2026
Merged

feat(wam-clojure): add lowered emitter scaffold#1703
s243a merged 1 commit intomainfrom
feat/wam-clojure-lowered-emitter-scaffold

Conversation

@s243a
Copy link
Copy Markdown
Owner

@s243a s243a commented Apr 29, 2026

Summary

Add the first implementation slice of the Clojure lowered-WAM tier:

  • new wam_clojure_lowered_emitter.pl
  • focused unit tests for parsing, lowerability, naming, and first-slice
    emission

This is the first implementation PR that follows the merged lowered-tier
design docs. It does not wire the new tier into
wam_clojure_target.pl yet.

What’s included

New module

  • src/unifyweaver/targets/wam_clojure_lowered_emitter.pl

It provides:

  • wam_clojure_lowerable/3
  • is_deterministic_pred_clojure/1
  • clojure_lowered_func_name/2
  • lower_predicate_to_clojure/4

New tests

  • tests/test_wam_clojure_lowered_emitter.pl

Coverage includes:

  • deterministic predicate lowerability
  • conservative clause-1 lowerability for multi-clause predicates
  • rejection of unsupported shapes such as switch_on_constant
  • lowered function-name normalization
  • first-slice emitted Clojure function shape
  • call_foreign presence in the lowered scaffold

Scope

This PR is intentionally narrow.

It adds the missing lowered-emitter module but does not yet:

  • route hybrid Clojure predicates through the new tier
  • change wam_clojure_target.pl
  • add atom/functor interning
  • change LMDB/runtime behavior

That keeps the first implementation step small and testable.

Why this is next

The main architectural gap versus Rust was the lack of a real hybrid
middle tier between:

  • classic native clause lowering
  • and full WAM interpretation

This scaffold establishes that missing tier without prematurely
entangling it with routing, runtime changes, or interning work.

Follow-up

The next PR should:

  1. wire the lowered tier into wam_clojure_target.pl
  2. add target-level routing for:
    • native
    • lowered WAM
    • foreign/kernel
    • full WAM fallback
  3. then begin atom/functor intern-table scaffolding

@s243a s243a merged commit 31a2c27 into main Apr 29, 2026
4 checks passed
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.

1 participant