ocaml: phase 4 bitwise ops land/lor/lxor/lsl/lsr/asr + bits.ml baseline (+5 tests, 607 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s

The binop precedence table already had land/lor/lxor/lsl/lsr/asr
(iter 0 setup) but eval-op fell through to 'unknown operator' for
all of them. SX doesn't expose host bitwise primitives, so each is
implemented in eval.sx via arithmetic on the host:

  land/lor/lxor:  mask & shift loop, accumulating 1<<k digits
  lsl k:          repeated * 2 k times
  lsr k:          repeated floor (/ 2) k times
  asr:            aliased to lsr (no sign extension at our bit width)

bits.ml baseline: popcount via 'while m > 0 do if m land 1 = 1 then
... ; m := m lsr 1 done'. Sum of popcount(1023, 5, 1024, 0xff) = 10
+ 2 + 1 + 8 = 21.

  5 land 3 = 1
  5 lor 3 = 7
  5 lxor 3 = 6
  1 lsl 8 = 256
  256 lsr 4 = 16

41 baseline programs total.
This commit is contained in:
2026-05-09 09:15:00 +00:00
parent 70b9b4f6cf
commit aaaf054441
5 changed files with 113 additions and 0 deletions

View File

@@ -407,6 +407,14 @@ _Newest first._
binary search tree (`type 'a tree = Leaf | Node of 'a * 'a tree *
'a tree`) with insert + in-order traversal. Tests parametric ADT,
recursive match, List.append, List.fold_left.
- 2026-05-09 Phase 4 — bitwise ops `land`/`lor`/`lxor`/`lsl`/`lsr`/
`asr` + bits.ml baseline (popcount-sum = 21) (+5 tests, 607 total).
The binop precedence table already had these but eval-op fell
through to "unknown operator". Implemented in eval.sx via
arithmetic on the host (mod / floor / div) since SX doesn't expose
bitwise primitives. asr aliased to lsr (no sign extension at our
bit width). bits.ml exercises `m land 1` + `m lsr 1` inside a while
loop. 41 baseline programs total.
- 2026-05-09 Phase 5.1 — ackermann.ml baseline (Ackermann function,
ack(3, 4) = 125). Three-arm recursion: m=0 base, n=0 reduces m,
else doubly-nested recursion `ack (m-1) (ack m (n-1))`. ack(3, 4)