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
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.
This commit is contained in:
@@ -407,6 +407,17 @@ _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 5.1 — caesar.ml baseline (ROT13 with String.init +
|
||||
s.[i] + Char.code/chr). Side-quests:
|
||||
(1) top-level `let r = expr in body` is now treated as an expression
|
||||
decl when has-matching-in? returns true at the dispatcher. Slices via
|
||||
skip-let-rhs-boundary which already opens depth on a leading let
|
||||
with matching in;
|
||||
(2) added String.make / String.init / String.map to runtime;
|
||||
(3) bumped lib/ocaml/baseline/run.sh per-program timeout 240→480s
|
||||
for headroom on contended hosts.
|
||||
Test = `Char.code r.[0] + Char.code r.[4]` after ROT13 round-trip on
|
||||
"hello" → 215 (h+o).
|
||||
- 2026-05-08 Phase 4 — `s.[i]` string indexing syntax (+3 tests, 484
|
||||
total). parse-atom-postfix now handles `.[expr]` after `.`,
|
||||
emitting `(:string-get S I)`; eval reduces to host `(nth s i)`.
|
||||
|
||||
Reference in New Issue
Block a user