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
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.
This commit is contained in:
@@ -394,6 +394,14 @@ _Newest first._
|
||||
recognise `!` as the prefix-deref of an application argument, so
|
||||
`String.concat "" (List.rev !b)` parses as `(... (deref b))`. Buffer
|
||||
uses a ref holding a string list; contents reverses and concats.
|
||||
- 2026-05-08 Phase 5.1+1+2 — calc.ml baseline (11/11 pass) — a
|
||||
recursive-descent calculator parsing `(1 + 2) * 3 + 4` to 13. Two
|
||||
parser bugs fixed along the way: parse-let now handles inline
|
||||
`let rec ... and ... in body` via new `:let-rec-mut` / `:let-mut`
|
||||
AST shapes (eval supports both); `has-matching-in?` no longer stops
|
||||
at `and` (which is internal to a let-rec, not a decl boundary). The
|
||||
baseline exercises mutually-recursive functions, while-loops, and
|
||||
ref-cell-driven imperative parsing.
|
||||
- 2026-05-08 Phase 5.1 — word_count.ml baseline (10/10 pass). Uses
|
||||
Map.Make(StrOrd) + List.fold_left to count word frequencies; tests
|
||||
the full functor pipeline with a real OCaml idiom.
|
||||
|
||||
Reference in New Issue
Block a user