ocaml: phase 1 sequence operator ; (+10 tests, 123 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 53s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 53s
Two-phase grammar: parse-expr-no-seq (prior entry) + parse-expr wraps it with ;-chaining. List bodies keep parse-expr-no-seq so ; remains a separator inside [...]. Match clause bodies use the seq variant and stop at | — real OCaml semantics. Trailing ; before end/)/|/in/then/else/eof permitted.
This commit is contained in:
@@ -128,11 +128,12 @@ 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 `()`. 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.)_
|
||||
`fun`/`->`, `match`/`with`, tuples, list literals, sequences `;`,
|
||||
`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, `try`/`with`,
|
||||
`function`, record literals/updates, field access, `and` mutually-recursive
|
||||
bindings.)_
|
||||
- [~] **Patterns:** constructor (nullary + with args, incl. flattened tuple
|
||||
args `Pair (a, b)` → `(:pcon "Pair" PA PB)`), literal (int/string/char/
|
||||
bool/unit), variable, wildcard `_`, tuple, list cons `::`, list literal.
|
||||
@@ -314,6 +315,14 @@ the "mother tongue" closure: OCaml → SX → OCaml. This means:
|
||||
|
||||
_Newest first._
|
||||
|
||||
- 2026-05-07 Phase 1 — sequence operator `;`. Lowest-precedence binary;
|
||||
`e1; e2; e3` → `(:seq e1 e2 e3)`. Two-phase grammar: `parse-expr-no-seq`
|
||||
is the prior expression entry point; new `parse-expr` wraps it with
|
||||
`;` chaining. List-literal items still use `parse-expr-no-seq` so `;`
|
||||
retains its separator role inside `[…]`. Match-clause bodies use the
|
||||
seq variant and stop at `|`, matching real OCaml semantics. Trailing `;`
|
||||
before `end`/`)`/`|`/`in`/`then`/`else`/eof is permitted. 123/123 tests
|
||||
passing (+10).
|
||||
- 2026-05-07 Phase 1 — `match`/`with` + pattern parser. Patterns: wildcard,
|
||||
literal, var, ctor (nullary + with arg, with tuple-arg flattening so
|
||||
`Pair (a, b)` → `(:pcon "Pair" PA PB)`), tuple, list literal, cons `::`
|
||||
|
||||
Reference in New Issue
Block a user