ocaml: phase 1 top-level decls (+9 tests, 104 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 49s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 49s
ocaml-parse-program: program = decls + bare exprs, ;;-separated. Each decl is (:def …), (:def-rec …), or (:expr …). Body parsing re-feeds the source slice through ocaml-parse — shared-state refactor deferred.
This commit is contained in:
@@ -128,10 +128,11 @@ SX CEK evaluator (both JS and OCaml hosts)
|
||||
- [~] **Parser:** expressions: literals, identifiers, constructor application,
|
||||
lambda, application (left-assoc), binary ops with precedence (29 ops via
|
||||
`lib/guest/pratt.sx`), `if`/`then`/`else`, `let`/`in`, `let rec`,
|
||||
`fun`/`->`, tuples, list literals, `begin`/`end`, unit `()`. _(Pending:
|
||||
top-level `let`/`type`/`module`/`exception`/`open`/`include` decls,
|
||||
`match`/`with`, `try`/`with`, `function`, record literals/updates,
|
||||
field access, sequences `;`.)_
|
||||
`fun`/`->`, tuples, list literals, `begin`/`end`, unit `()`. Top-level
|
||||
decls: `let [rec] name params* = expr` and bare expressions, `;;`-separated
|
||||
via `ocaml-parse-program`. _(Pending: `type`/`module`/`exception`/`open`/
|
||||
`include` decls, `match`/`with`, `try`/`with`, `function`, record literals/
|
||||
updates, field access, sequences `;`, `and` mutually-recursive bindings.)_
|
||||
- [ ] **Patterns:** constructor, literal, variable, wildcard `_`, tuple, list cons `::`,
|
||||
list literal, record, `as`, or-pattern `P1 | P2`, `when` guard.
|
||||
- [ ] OCaml is **not** indentation-sensitive — no layout algorithm needed.
|
||||
@@ -310,6 +311,12 @@ the "mother tongue" closure: OCaml → SX → OCaml. This means:
|
||||
|
||||
_Newest first._
|
||||
|
||||
- 2026-05-07 Phase 1 — top-level program parser `ocaml-parse-program`. Parses
|
||||
a sequence of `let [rec] name params* = expr` decls and bare expressions
|
||||
separated by `;;`. Output `(:program DECLS)` with each decl one of `(:def …)`,
|
||||
`(:def-rec …)`, `(:expr E)`. Decl bodies parsed by re-feeding the source
|
||||
slice through `ocaml-parse` (cheap stand-in until shared-state refactor).
|
||||
104/104 tests now passing (+9).
|
||||
- 2026-05-07 Phase 1 — `lib/ocaml/parser.sx` expression parser consuming
|
||||
`lib/guest/pratt.sx` for binop precedence (29 operators across 8 levels,
|
||||
incl. keyword-spelled binops `mod`/`land`/`lor`/`lxor`/`lsl`/`lsr`/`asr`).
|
||||
|
||||
Reference in New Issue
Block a user