Commit Graph

9 Commits

Author SHA1 Message Date
360a3ed51f ocaml: phase 5.1 queens.ml baseline (15/15 pass)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
4-queens via recursive backtracking + List.fold_left. Returns 2 (the
two solutions of 4-queens). Per-program timeout in run.sh bumped to
240s — the tree-walking interpreter is slow on heavy recursion but
correct.

The substrate handles full backtracking + safe-check recursion +
list-driven candidate enumeration end-to-end.
2026-05-08 19:04:04 +00:00
50a219b688 ocaml: phase 5.1 mutable_record.ml baseline (14/14 pass)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s
Counter-style record with two mutable fields. Validates the new
r.f <- v field mutation end-to-end through type decl + record literal
+ field access + field assignment + sequence operator.

  type counter = { mutable count : int; mutable last : int }
  let bump c = c.count <- c.count + 1 ; c.last <- c.count

After 5 bumps: count=5, last=5, sum=10.
2026-05-08 18:43:19 +00:00
0858986877 ocaml: phase 5.1 btree.ml baseline (13/13 pass)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 37s
Polymorphic binary search tree with insert + in-order traversal.
Exercises parametric ADT (type 'a tree = Leaf | Node of 'a * 'a tree
* 'a tree), recursive match, List.append, List.fold_left.
2026-05-08 17:52:49 +00:00
d8f1882b50 ocaml: phase 5.1 fizzbuzz.ml baseline (12/12 pass)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 32s
Classic fizzbuzz using ref-cell accumulator, for-loop, mod, if/elseif
chain, String.concat, Int.to_string. Output verified via String.length
of the comma-joined result for n=15: 57.
2026-05-08 17:44:07 +00:00
ffa74399fd ocaml: phase 5.1 calc.ml baseline (11/11 pass) + inline let-rec-and parser fix
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 54s
Recursive-descent calculator parses '(1 + 2) * 3 + 4' = 13. Two parser
bugs fixed:

1. parse-let now handles inline 'let rec a () = ... and b () = ... in
   body' via new (:let-rec-mut BINDINGS BODY) and (:let-mut BINDINGS
   BODY) AST shapes; eval handles both.

2. has-matching-in? lookahead no longer stops at 'and' — 'and' is
   internal to let-rec, not a decl boundary. Without this fix, the
   inner 'let rec a () = ... and b () = ...' inside a let-decl rhs
   would have been treated as the start of a new top-level decl.

Baseline exercises mutually-recursive functions, while-loops, ref-cell
imperative parsing, and ADT-based AST construction.
2026-05-08 16:53:44 +00:00
dbe3c6c203 ocaml: phase 5.1 word_count.ml baseline (10/10 pass)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 29s
Uses Map.Make(StrOrd) + List.fold_left to count word frequencies;
exercises the full functor pipeline with a real-world idiom:

  let inc_count m word =
    match StrMap.find_opt word m with
    | None -> StrMap.add word 1 m
    | Some n -> StrMap.add word (n + 1) m
  let count words = List.fold_left inc_count StrMap.empty words

10/10 baseline programs pass.
2026-05-08 16:11:03 +00:00
0cf5c8f219 ocaml: phase 5.1 expr_eval.ml baseline (9/9 pass)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 52s
A tiny arithmetic-expression evaluator using:
  type expr = Lit of int | Add of expr*expr | Mul of expr*expr | Neg of expr
  let rec eval e = match e with | Lit n -> n | Add (a,b) -> ...

Exercises type-decl + multi-arg ctor + recursive match end-to-end.
Per-program timeout in run.sh bumped to 120s.
2026-05-08 15:01:04 +00:00
46d0eb258e ocaml: phase 5.1 baseline 8/8 — quicksort + exceptions + closures
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 38s
Added 3 baseline programs:
- closures.ml — curried make_adder; verifies closure capture
- quicksort.ml — recursive sort using List.filter + List.append, sums result
- exception_handle.ml — exception NegArg of int + raise + try/with

All 8/8 baseline programs pass through ocaml-run-program. Combined the
suite exercises: let-rec, modules, refs, for-loops, pattern matching,
exceptions, lambdas, list ops (map/filter/append/fold), arithmetic.

run.sh streamlined to one sx_server invocation per program. End-to-end
runtime ≈2 min.
2026-05-08 13:44:28 +00:00
de7be332c8 ocaml: phase 5.1 baseline OCaml programs (5/5 pass) + lookahead boundary
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 33s
lib/ocaml/baseline/{factorial,list_ops,option_match,module_use,sum_squares}.ml
exercised through ocaml-run-program (file-read F). lib/ocaml/baseline/
run.sh runs them and compares against expected.json — all 5 pass.

To make module_use.ml (with nested let-in) parse, parser's
skip-let-rhs-boundary! now uses has-matching-in? lookahead: a let at
depth 0 in a let-decl rhs opens a nested block IFF a matching in
exists before any decl-keyword. Without that in, the let is a new
top-level decl (preserves test 274 'let x = 1 let y = 2').

This is the first piece of Phase 5.1 'vendor a slice of OCaml
testsuite' — handcrafted fixtures for now, real testsuite TBD.
2026-05-08 13:33:24 +00:00