diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f576f5..71afc84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,33 @@ A version section here is written when that release is prepared, which is before it is published. A section records what its version carries; whether that version is on the registry is a question for the registry. +## [0.4.0] 2026-10-01 + +A minor release. The statement grammar compiles from source: `compileProgram`, +`compileProgramWithPositions` and `compileProgramWithSpans` are new, and +`ParseReason` gains the three refusals only they answer. `execute` and +`executeValue` compile a source string as a statement program, as the +reference's do, so a source the expression grammar refused may now run, a +source either grammar refuses may answer the program grammar's refusal, and +`executeValue` given an expression's source now answers that expression's +value. `executeTagged`, `durationToMilliseconds` and the `DecompileResult` type +are new; the protected-root refusal names its root under `details.root`; and a +duration text whose component is past the largest safe integer is refused. + +### Added + +- A `store` refused for writing into a protected root answers an `EvaluationError` that names that root under `details.root`, so a host reads the root without parsing the message; the reason and the message are unchanged, and every other refusal leaves `details` absent. +- `durationToMilliseconds` answers a duration's length in milliseconds by the reference's weights: a week of seven days, a month of thirty and a year of three hundred and sixty five. +- `executeTagged` on the `./tagged` subpath runs a statement program, from a compiled list or from source text, and answers the context it halted with as the tagged encoding's text on both arms, so `decodeTagged` reads every value back as the one the program bound: a float the program stored stays a float, where `execute`'s plain projection answers the integer. +- `DecompileResult` names the result `decompile` answers - the rendered `source` on the succeeding arm, or the `ParseError` that refused the tree on the failing one - so a host can annotate it by name, as it does `ParseResult` and `CompileResult`, instead of deriving it from the function; the shape is unchanged. +- `compileProgram`, `compileProgramWithPositions` and `compileProgramWithSpans` compile a statement program from source text - assignments, `;`-separated statements, `if`/`else`, `else if` and `while` - to the instruction list `execute` and `executeValue` run, answering the results `compile`, `compileWithPositions` and `compileWithSpans` answer, with one more table on the two located variants: `segmentPositions` or `segmentSpans`, one entry per segment of the location each `store` writes. +- `ParseReason` gains `unexpected_else`, `unassignable_location` and `expected_open_brace`, which only the three program entry points answer; a caller that switches exhaustively on the union adds the three cases. + +### Changed + +- `execute` and `executeValue` compile a source string as a statement program, as the reference's do, where they compiled it as an expression; `evaluate` still compiles an expression. Two effects follow: a source the expression grammar refused may now run (`execute("x = 1")` binds `x`), and a source either grammar refuses may answer the program grammar's refusal, with a different message or reason (`score 3` is refused as unexpected "after statement" rather than "after expression"). One more follows from the first: `executeValue` given an expression's source now answers that expression's value, where it answered undefined. A caller that wants a source refused unless it is an expression compiles it with `compile` and passes the instruction list. +- A duration text whose component is past the largest safe integer is refused: `::duration` answers undefined and `parseDuration` answers `invalid_duration_format`, where both used to answer a duration whose component was infinite or rounded. The reference, whose integers have no bound, answers such a text with a duration. + ## [0.3.0] 2026-09-30 A minor release. The vendored conformance corpus moves to the reference's diff --git a/README.md b/README.md index fcee54c..8b49461 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ version can be deprecated but not recalled. A registry is live: read it yourself rather than trusting this paragraph's date. ```bash -pnpm add @riddler/predicator@^0.3.0 +pnpm add @riddler/predicator@^0.4.0 ``` The version is named because a bare install resolves to whatever the registry diff --git a/changelog.d/pts-0o0p.md b/changelog.d/pts-0o0p.md deleted file mode 100644 index 71c91bb..0000000 --- a/changelog.d/pts-0o0p.md +++ /dev/null @@ -1,3 +0,0 @@ -### Added - -- A `store` refused for writing into a protected root answers an `EvaluationError` that names that root under `details.root`, so a host reads the root without parsing the message; the reason and the message are unchanged, and every other refusal leaves `details` absent. diff --git a/changelog.d/pts-0zns.md b/changelog.d/pts-0zns.md deleted file mode 100644 index 49c4ba2..0000000 --- a/changelog.d/pts-0zns.md +++ /dev/null @@ -1,3 +0,0 @@ -### Changed - -- `execute` and `executeValue` compile a source string as a statement program, as the reference's do, where they compiled it as an expression; `evaluate` still compiles an expression. Two effects follow: a source the expression grammar refused may now run (`execute("x = 1")` binds `x`), and a source either grammar refuses may answer the program grammar's refusal, with a different message or reason (`score 3` is refused as unexpected "after statement" rather than "after expression"). One more follows from the first: `executeValue` given an expression's source now answers that expression's value, where it answered undefined. A caller that wants a source refused unless it is an expression compiles it with `compile` and passes the instruction list. diff --git a/changelog.d/pts-ix34.md b/changelog.d/pts-ix34.md deleted file mode 100644 index 4a486de..0000000 --- a/changelog.d/pts-ix34.md +++ /dev/null @@ -1,3 +0,0 @@ -### Added - -- `durationToMilliseconds` answers a duration's length in milliseconds by the reference's weights: a week of seven days, a month of thirty and a year of three hundred and sixty five. diff --git a/changelog.d/pts-mmls.md b/changelog.d/pts-mmls.md deleted file mode 100644 index 2986d71..0000000 --- a/changelog.d/pts-mmls.md +++ /dev/null @@ -1,3 +0,0 @@ -### Added - -- `executeTagged` on the `./tagged` subpath runs a statement program, from a compiled list or from source text, and answers the context it halted with as the tagged encoding's text on both arms, so `decodeTagged` reads every value back as the one the program bound: a float the program stored stays a float, where `execute`'s plain projection answers the integer. diff --git a/changelog.d/pts-o0gr.md b/changelog.d/pts-o0gr.md deleted file mode 100644 index fd3ebb5..0000000 --- a/changelog.d/pts-o0gr.md +++ /dev/null @@ -1,3 +0,0 @@ -### Changed - -- A duration text whose component is past the largest safe integer is refused: `::duration` answers undefined and `parseDuration` answers `invalid_duration_format`, where both used to answer a duration whose component was infinite or rounded. The reference, whose integers have no bound, answers such a text with a duration. diff --git a/changelog.d/pts-shdy.md b/changelog.d/pts-shdy.md deleted file mode 100644 index baf119c..0000000 --- a/changelog.d/pts-shdy.md +++ /dev/null @@ -1,3 +0,0 @@ -### Added - -- `DecompileResult` names the result `decompile` answers - the rendered `source` on the succeeding arm, or the `ParseError` that refused the tree on the failing one - so a host can annotate it by name, as it does `ParseResult` and `CompileResult`, instead of deriving it from the function; the shape is unchanged. diff --git a/changelog.d/pts-xmz6.md b/changelog.d/pts-xmz6.md deleted file mode 100644 index a7201e9..0000000 --- a/changelog.d/pts-xmz6.md +++ /dev/null @@ -1,4 +0,0 @@ -### Added - -- `compileProgram`, `compileProgramWithPositions` and `compileProgramWithSpans` compile a statement program from source text - assignments, `;`-separated statements, `if`/`else`, `else if` and `while` - to the instruction list `execute` and `executeValue` run, answering the results `compile`, `compileWithPositions` and `compileWithSpans` answer, with one more table on the two located variants: `segmentPositions` or `segmentSpans`, one entry per segment of the location each `store` writes. -- `ParseReason` gains `unexpected_else`, `unassignable_location` and `expected_open_brace`, which only the three program entry points answer; a caller that switches exhaustively on the union adds the three cases. diff --git a/package.json b/package.json index 68fa1b9..98149ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@riddler/predicator", - "version": "0.3.0", + "version": "0.4.0", "description": "A conformant TypeScript sibling of the Predicator reference implementation: the expression language, its instruction set architecture, and the shared conformance corpus.", "license": "MIT", "type": "module",