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
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.
This commit is contained in:
6
lib/ocaml/baseline/sum_squares.ml
Normal file
6
lib/ocaml/baseline/sum_squares.ml
Normal file
@@ -0,0 +1,6 @@
|
||||
(* Baseline: imperative loop summing squares *)
|
||||
let total = ref 0 ;;
|
||||
for i = 1 to 10 do
|
||||
total := !total + i * i
|
||||
done ;;
|
||||
!total
|
||||
Reference in New Issue
Block a user