Commit Graph

2544 Commits

Author SHA1 Message Date
bd2cd8aad1 ocaml: phase 5.1 levenshtein.ml baseline (no-memo edit distance, sum=11)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 35s
Recursive Levenshtein edit distance with no memoization (the test
strings are short enough for the exponential-without-memo version to
fit in <2 minutes on contended hosts). Sums distances for five short
pairs:

  ('abc','abx') + ('ab','ba') + ('abc','axyc') + ('','abcd') + ('ab','')
   = 1 + 2 + 2 + 4 + 2 = 11

Exercises:
  * curried four-arg recursion
  * s.[i] equality test (char comparison)
  * min nested twice for the three-way recurrence
  * mixed empty-string base cases
2026-05-09 00:23:58 +00:00
0234ae329e ocaml: phase 5.1 caesar.ml baseline (ROT13 + s.[i] + Char ops)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Side-quests required to land caesar.ml:

1. Top-level 'let r = expr in body' is now an expression decl, not a
   broken decl-let. ocaml-parse-program's dispatch now checks
   has-matching-in? at every top-level let; if matched, slices via
   skip-let-rhs-boundary (which already opens depth on a leading let
   with matching in) and ocaml-parse on the slice, wrapping as :expr.

2. runtime.sx: added String.make / String.init / String.map. Used by
   caesar.ml's encode = String.init n (fun i -> shift_char s.[i] k).

3. baseline run.sh per-program timeout 240->480s (system load on the
   shared host frequently exceeds 240s for large baselines).

caesar.ml exercises:
  * the new top-level let-in expression dispatch
  * s.[i] string indexing
  * Char.code / Char.chr round-trip math
  * String.init with a closure that captures k

Test value: Char.code r.[0] + Char.code r.[4] after ROT13(ROT13('hello')) = 104 + 111 = 215.
2026-05-09 00:13:11 +00:00
f895a118fb ocaml: phase 4 's.[i]' string indexing syntax (+3 tests, 484 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 44s
parse-atom-postfix now dispatches three cases after consuming '.':

  .field  -> existing field/module access
  .(EXPR) -> existing local-open
  .[EXPR] -> new string-get syntax  (this commit)

Eval reduces (:string-get S I) to host (nth S I), which already returns
a one-character string for OCaml's char model.

Lets us write idiomatic OCaml string traversal:

  let s = "hi" in
  let n = ref 0 in
  for i = 0 to String.length s - 1 do
    n := !n + Char.code s.[i]
  done;
  !n  (* = 209 *)
2026-05-08 23:58:37 +00:00
bc4f4a5477 ocaml: phase 5.1 roman.ml baseline + top-level 'let () = expr'
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 51s
Side-quest emerged from adding roman.ml baseline (Roman numeral greedy
encoding): top-level 'let () = expr' was unsupported because
ocaml-parse-program's parse-decl-let consumed an ident strictly. Now
parse-decl-let recognises a leading '()' as a unit binding and
synthesises a __unit_NN name (matching how parse-let already handles
inner-let unit patterns).

roman.ml exercises:
  * tuple list literal [(int * string); ...]
  * recursive pattern match on tuple-cons
  * String.length + List.fold_left
  * the new top-level let () support (sanity in a comment, even though
    the program ends with a bare expression for the test harness)

Bumped lib/ocaml/test.sh server timeout 180->360s — the recent surge in
test count plus a CPU-contended host was crowding out the sole epoch
reaching the deeper smarts.
2026-05-08 23:40:36 +00:00
982e9680fe ocaml: phase 4 'M.(expr)' local-open expression form (+3 tests, 481 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
In parse-atom-postfix, after consuming '.', if the next token is '(',
parse the inner expression and emit (:let-open M EXPR) instead of
:field. Cleanly composes with the existing :let-open evaluator and
loops to allow chained dot postfixes.

  List.(length [1;2;3])                = 3
  List.(map (fun x -> x + 1) [1;2;3])   = [2;3;4]
  Option.(map (fun x -> x * 10) (Some 4)) = Some 40
2026-05-08 21:43:38 +00:00
6dc535dde3 ocaml: phase 4 'let open M in body' local opens (+3 tests, 478 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
Parser detects 'let open' as a separate let-form, parses M as a path
(Ctor(.Ctor)*) directly via inline AST construction (no source slicing
since cur-pos is only available in ocaml-parse-program), and emits
(:let-open PATH BODY).

Eval resolves the path to a module dict and merges its bindings into
the env for body evaluation. Now:

  let open List in map (fun x -> x * 2) [1;2;3]   = [2;4;6]
  let open Option in map (fun x -> x + 1) (Some 5) = Some 6
2026-05-08 21:33:14 +00:00
0530120bc7 ocaml: phase 4 def-mut / def-rec-mut inside modules (+2 tests, 475 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
ocaml-eval-module now handles :def-mut and :def-rec-mut decls so
'module M = struct let rec a n = ... and b n = ... end' works. The
def-rec-mut version uses cell-based mutual recursion exactly as the
top-level version.
2026-05-08 21:14:07 +00:00
6d9ac1e55a ocaml: phase 5.1 bfs.ml baseline (20/20 pass)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 20s
Graph BFS using Queue + Hashtbl visited-set + List.assoc_opt + List.iter.
Returns 6 for a graph where A reaches B/C/D/E/F. Demonstrates 4 stdlib
modules (Queue, Hashtbl, List) cooperating in a real algorithm.
2026-05-08 21:05:32 +00:00
a4ef9a8ec9 ocaml: phase 1 type annotations on let / (e : T) (+4 tests, 473 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
let NAME [PARAMS] : T = expr and (expr : T) parse and skip the type
source. Runtime no-op since SX is dynamic. Works in inline let,
top-level let, and parenthesised expressions:

  let x : int = 5 ;; x + 1                        -> 6
  let f (x : int) : int = x + 1 in f 41           -> 42
  (5 : int)                                       -> 5
  ((1 + 2) : int) * 3                             -> 9
2026-05-08 20:58:50 +00:00
ce75bd6848 ocaml: phase 1+5.1 type aliases + poly_stack baseline (+3 tests, 469 / 19 baseline)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
Parser: in parse-decl-type, dispatch on the post-= token:
  '|' or Ctor   -> sum type
  '{'           -> record type
  otherwise     -> type alias (skip to boundary)
AST (:type-alias NAME PARAMS) with body discarded. Runtime no-op since
SX has no nominal types.

poly_stack.ml baseline exercises:
  module type ELEMENT = sig type t val show : t -> string end
  module IntElem = struct type t = int let show x = ... end
  module Make (E : ELEMENT) = struct ... use E.show ... end
  module IntStack = Make(IntElem)

Demonstrates the substrate handles signature decls + abstract types +
functor parameter with sig constraint.
2026-05-08 20:49:26 +00:00
c7d8b7dd62 ocaml: phase 2+3 'when' guard in try/with (+3 tests, 467 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 27s
parse-try now consumes optional 'when GUARD-EXPR' before -> and emits
(:case-when PAT GUARD BODY). Eval try clause loop dispatches on case /
case-when and falls through on guard false — same semantics as match.

Examples:
  try raise (E 5) with | E n when n > 0 -> n | _ -> 0   = 5
  try raise (E (-3)) with | E n when n > 0 -> n | _ -> 0 = 0
  try raise (E 5) with | E n when n > 100 -> n | E n -> n + 1000  = 1005
2026-05-08 20:36:02 +00:00
029c1783f4 ocaml: phase 1+3 'when' guard in 'function | pat -> body' (+3 tests, 464 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s
parse-function now consumes optional 'when GUARD-EXPR' before -> and
emits (:case-when PAT GUARD BODY) — same handling as match clauses.
function-style sign extraction now works:
  (function | n when n > 0 -> 1 | n when n < 0 -> -1 | _ -> 0)
2026-05-08 20:26:28 +00:00
b92a98fb45 ocaml: refresh scoreboard (480/480 across 15 suites incl. 18 baseline programs)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
2026-05-08 20:12:35 +00:00
8fab20c8bc ocaml: phase 5.1 anagrams.ml baseline (18/18 pass)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 47s
Group anagrams by canonical (sorted-chars) key using Hashtbl +
List.sort. Demonstrates char-by-char traversal via String.get + for-loop +
ref accumulator + Hashtbl as a multi-valued counter.
2026-05-08 19:57:09 +00:00
de8b1dd681 ocaml: phase 5.1 lambda_calc.ml baseline (17/17 pass)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
Untyped lambda calculus interpreter inside OCaml-on-SX:
  type term = Var | Abs of string * term | App | Num of int
  type value = VNum of int | VClos of string * term * env
  let rec eval env t = match t with ...

(\x.\y.x) 7 99 = 7. The substrate handles two ADTs, recursive eval,
closure-based env, and pattern matching all written as a single
self-contained OCaml program — strong validation.
2026-05-08 19:49:08 +00:00
ce81ce2e95 ocaml: phase 6 Char predicates (+7 tests, 461 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s
Char.is_digit / is_alpha / is_alnum / is_whitespace / is_upper /
is_lower / is_space — all written in OCaml using Char.code + ASCII
range checks.
2026-05-08 19:42:00 +00:00
8c7ad62b44 ocaml: phase 5 HM def-mut + def-rec-mut at top level (+3 tests, 454 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
ocaml-type-of-program now handles :def-mut (sequential generalize) and
:def-rec-mut (pre-bind tvs, infer rhs, unify, generalize all, infer
body — same algorithm as the inline let-rec-mut version).

Mutual top-level recursion now type-checks:
  let rec even n = ... and odd n = ...;; even 10           : Bool
  let rec map f xs = ... and length lst = ...;; map :
                              ('a -> 'b) -> 'a list -> 'b list
2026-05-08 19:19:17 +00:00
fff8fe2dc8 ocaml: phase 5.1 memo_fib.ml baseline (16/16 pass)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Memoized fibonacci using Hashtbl.find_opt + Hashtbl.add.
fib(25) = 75025. Demonstrates mutable Hashtbl through the OCaml
stdlib API in real recursive code.
2026-05-08 19:10:49 +00:00
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
d9979eaf6c ocaml: phase 2 mutable record fields r.f <- v (+4 tests, 451 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 27s
<- added to op-table at level 1 (same as :=). Eval short-circuits on
<- to mutate the lhs's field via host SX dict-set!. The lhs must be a
:field expression; otherwise raises.

Tested:
  let r = { x = 1; y = 2 } in r.x <- 5; r.x       (5)
  let r = { x = 0 } in for i = 1 to 5 do r.x <- r.x + i done; r.x  (15)
  let r = { name = ...; age = 30 } in r.name <- "Alice"; r.name

The 'mutable' keyword in record type decls is parsed-and-discarded;
runtime semantics: every field is mutable. Phase 2 closes this gap
without changing the dict-based record representation.
2026-05-08 18:35:31 +00:00
66da0e5b84 ocaml: phase 1+3 record type declarations (+3 tests, 447 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s
type r = { x : int; mutable y : string } parses to
(:type-def-record NAME PARAMS FIELDS) with FIELDS each (NAME) or
(:mutable NAME). Parser dispatches on { after = to parse field list.
Field-type sources are skipped (HM registration TBD). Runtime no-op
since records already work as dynamic dicts.
2026-05-08 18:26:34 +00:00
f070bddb0e ocaml: phase 5.1 conformance.sh integrates baseline (458/458 across 15 suites)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
bash lib/ocaml/conformance.sh now runs lib/ocaml/baseline/run.sh and
aggregates pass/fail counts under a 'baseline' suite. Full-suite
scoreboard now reports both unit-test results and end-to-end OCaml
program runs in a single artifact.
2026-05-08 18:12:23 +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
0bc6dbd233 ocaml: phase 2+6 print primitives wire to host display (+2 tests, 444 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s
print_string / print_endline / print_int / print_newline now route to
SX display primitive (not the non-existent print/println). print_endline
appends '\n'.

let _ = expr ;; at top level confirmed working via the
wildcard-param parser.
2026-05-08 17:37:00 +00:00
cabf5dc9c3 ocaml: phase 5 HM let-mut / let-rec-mut (+3 tests, 442 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s
ocaml-infer-let-mut: each rhs inferred in parent env, generalized
sequentially before adding to body env.

ocaml-infer-let-rec-mut: pre-bind all names with fresh tvs; infer
each rhs against the joint env, unify each with its tv, then
generalize all and infer body.

Mutual recursion now type-checks:
  let rec even n = if n = 0 then true else odd (n - 1)
  and odd n = if n = 0 then false else even (n - 1)
  in even   : Int -> Bool
2026-05-08 17:28:27 +00:00
4909ebe2ad ocaml: phase 6 Option/Result/Bytes extensions (+9 tests, 439 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 29s
Option: join, to_result, some, none.
Result: value, iter, fold.
Bytes: length, get, of_string, to_string, concat, sub — thin alias of
String (SX has no separate immutable byte type).

Ordering fix: Bytes module placed after String so its closures capture
String in scope. Earlier draft put Bytes before String which made
String.* lookups fail with 'not a record/module' (treated as nullary
ctor).
2026-05-08 17:19:16 +00:00
f05d405bac ocaml: phase 6 Stack + Queue modules (+5 tests, 430 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 35s
Stack: ref-holding-list LIFO. push/pop/top/length/is_empty/clear.
Queue: two-list (front, back) amortised O(1) queue. push/pop/length/
is_empty/clear. Both in OCaml syntax in runtime.sx.
2026-05-08 17:03:32 +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
ecdd90345e ocaml: refresh scoreboard (426/426 across 14 suites)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 28s
2026-05-08 16:18:21 +00:00
2f271fa6a6 ocaml: phase 1+6 Buffer + parser !x in app args (+3 tests, 425 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
Parser fix: at-app-start? and parse-app's loop recognise prefix !
as a deref of the next app arg. So 'List.rev !b' parses as
'(:app List.rev (:deref b))' instead of stalling at !.

Buffer module backed by a ref holding string list:
  create _ = ref []
  add_string b s = b := s :: !b
  contents b = String.concat "" (List.rev !b)
  add_char/length/clear/reset
2026-05-08 16:16:52 +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
404c908a9a ocaml: phase 6 Map/Set extensions iter/fold/filter/union/inter (+4 tests, 422 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 32s
Map.Make: iter, fold, map, filter, is_empty added.
Set.Make: iter, fold, filter, is_empty, union, inter added.

All written in OCaml inside the existing functor bodies. Tested:
  IntMap.fold (fun k v acc -> acc + v) m 0           = 30
  IntSet.elements (IntSet.union {1,2} {2,3})         = [1; 2; 3]
  IntSet.elements (IntSet.inter {1,2,3} {2,3,4})     = [2; 3]
2026-05-08 16:02:45 +00:00
b297c83b1d ocaml: refresh scoreboard (419/419 across 14 suites)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
2026-05-08 15:51:36 +00:00
85867e329b ocaml: phase 6 Map.Make / Set.Make functors (+4 tests, 418 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
Both written in OCaml inside lib/ocaml/runtime.sx:

  module Map = struct module Make (Ord) = struct
    let empty = []
    let add k v m = ... (* sorted insert via Ord.compare *)
    let find_opt / find / mem / remove / bindings / cardinal
  end end

  module Set = struct module Make (Ord) = struct
    let empty = []
    let mem / add / remove / elements / cardinal
  end end

Sorted association list / sorted list backing — linear ops but
correct. Strong substrate-validation: Map.Make is a non-trivial
functor implemented entirely on top of the OCaml-on-SX evaluator.
2026-05-08 15:50:22 +00:00
cd93b11328 ocaml: phase 6 Sys module constants (+5 tests, 414 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s
os_type="SX", word_size=64, max_array_length, max_string_length,
executable_name="ocaml-on-sx", big_endian=false, unix=true,
win32=false, cygwin=false. Constants-only for now — argv/getenv_opt/
command would need host platform integration.
2026-05-08 15:46:33 +00:00
4bca2cacff ocaml: phase 5 parse ctor arg types in user type-defs (+3 tests, 409 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 36s
ocaml-hm-parse-type-src recognises primitive type names (int/bool/
string/float/unit), tyvars 'a, and simple parametric T list / T option.
Replaces the previous int-by-default placeholder in
ocaml-hm-register-type-def!.

So 'type tag = TStr of string | TInt of int' correctly registers
TStr : string -> tag and TInt : int -> tag. Pattern-match on tag
gives proper field types in the body. Multi-arg / function types
still fall back to a fresh tv.
2026-05-08 15:43:16 +00:00
d61ee088c5 ocaml: refresh scoreboard (407/407 across 14 suites)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
2026-05-08 15:35:28 +00:00
f40dfbbeb5 ocaml: phase 6 String extensions (+6 tests, 406 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s
ends_with, contains, trim, split_on_char, replace_all, index_of —
wrap host SX primitives via new _string_* builtins. String module
now substantively covers OCaml's Stdlib.String.
2026-05-08 15:34:18 +00:00
9f05e24c52 ocaml: phase 6 List.take/drop/filter_map/flat_map (+6 tests, 400 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 37s
Common functional helpers written in OCaml. flat_map / concat_map
share an implementation. 400-test milestone.
2026-05-08 15:30:29 +00:00
86343345dc ocaml: phase 1+3 or-patterns (P1 | P2 | ...) parens-only (+5 tests, 394 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 41s
Parser: when | follows a pattern inside parens, build (:por ALT1 ALT2
...). Eval: try alternatives, succeed on first match. Top-level |
remains the clause separator — parens-only avoids ambiguity without
lookahead.

Examples now work:
  match n with | (1 | 2 | 3) -> 100 | _ -> 0
  match c with | (Red | Green) -> 1 | Blue -> 2
2026-05-08 15:22:34 +00:00
ad252088c3 ocaml: phase 4 module type S = sig … end parser (+3 tests, 389 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 33s
module type S = sig DECLS end is parsed-and-discarded — sig..end
balanced skipping in parse-decl-module-type. AST (:module-type-def
NAME). Runtime no-op (signatures are type-level only).

Allows real OCaml programs with module type decls to parse and run
without stripping the sig blocks.
2026-05-08 15:11:45 +00:00
76ccbfbab6 ocaml: refresh scoreboard (387/387 across 14 suites)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s
2026-05-08 15:07:55 +00:00
98049d5458 ocaml: phase 1+3 record patterns { f = pat } (+4 tests, 386 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
Parser: { f1 = pat; f2 = pat; ... } in pattern position emits
(:precord (FIELDNAME PAT)...). Mixed with the existing { in
expression position via the at-pattern-atom? whitelist.

Eval: :precord matches against a dict; required fields must be present
and each pat must match the field's value. Can mix literal+var:
'match { x = 1; y = y } with | { x = 1; y = y } -> y' matches only
when x is 1.
2026-05-08 15:06:44 +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
9f539ab392 ocaml: phase 3 polymorphic variants (+4 tests, 382 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s
Tokenizer recognises backtick followed by an upper ident, emitting a
ctor token identical to a nominal ctor. Parser and evaluator treat
polyvariants as ctors — same tagged-list runtime. So:

  `Red                   -> ("Red")
  `Some 42               -> ("Some" 42)
  match `Red with | `Red -> 1 | `Green -> 2 | `Blue -> 3
                          -> 1
  `Pair (1,2)            -> ("Pair" 1 2) (with tuple-arg flatten)

Proper row types in HM deferred.
2026-05-08 14:03:09 +00:00
986b15c0e5 ocaml: phase 6 Float module: sqrt/sin/cos/pow/floor/ceil/round/pi (+6 tests, 378 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
Wraps host SX math primitives via _float_* builtins. Float.pi is a
Float literal in the OCaml-side module.
2026-05-08 13:58:52 +00:00
ee002f2e02 ocaml: phase 1/5/6 float arithmetic +./-./*./. (+5 tests, 372 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 27s
Tokenizer: +. -. *. /. (with -. avoiding clash with negative float
literals). Parser table places dotted ops at int-precedence levels.
Eval routes to host SX +/-/*//. HM types them Float->Float->Float;
literal floats now infer as Float (was Int).

OCaml-style 1.5 +. 2.5 : Float works end-to-end through tokenize +
parse + eval + infer.
2026-05-08 13:55:04 +00:00
16df48ff74 ocaml: phase 6 List.combine/split/iter2/fold_left2/map2 (+4, 367 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s
Mechanical pair-walk OCaml implementations. failwith on length
mismatch matches Stdlib semantics. List module now covers 30+
functions.
2026-05-08 13:48:48 +00:00