docs: ADR-29 + ROADMAP — reverse-bracket intervals & range properties
public
docs: ADR-29 + ROADMAP — reverse-bracket intervals & range properties Record the reverse-bracket interval literals (`]a..b]` lexer retag, `[a..b[` filter-free endpoint), the range-property handler, and the ingester relaxation as ADR-29; mark them done in the ADR-27/ADR-28 consequence lists. Update ROADMAP: suite 2720 → 2728, move reverse brackets + range properties from "Still deferred" to "Shipped", and sharpen the remaining two deferrals (`not(tests)`, unbounded ranges, value-position `(< 10)`) with their now-known grammar verdicts — each is LR(1)-clean, the block is semantic/eval, not the parser. Note the boxed-context limitation that keeps 0074's `range_*` property cases on a unit test rather than ingested. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| Changeset | c352959c2fec8cb5e85850a6c57ce6f004818a01 |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@gmail.com>, |
| Parents | 3ab10aa5762f |
| Children | |
| Pushlog | by timo via ssh |
modified DECISIONS.md +65 −5
| @@ -916,8 +916,9 @@ | ||
| 916 | 916 | - **Consequence:** ranges are first-class — constructible, comparable, type-checkable, |
| 917 | 917 | usable in value position and as `in` membership. Still deferred (the bracket-ambiguity |
| 918 | 918 | forms): comma-list-of-tests `in` (**now done, ADR-28**), the reverse-bracket interval |
| 919 | - notation `]a..b]` / `[a..b[`, unbounded ranges (`[1..]`, `(null..10)`), and the | |
| 920 | - comparison-test-as-range value (`(< 10)`). See ROADMAP.md for entry points. | |
| 919 | + notation `]a..b]` / `[a..b[` and the range properties (**now done, ADR-29**), unbounded | |
| 920 | + ranges (`[1..]`, `(null..10)`), and the comparison-test-as-range value (`(< 10)`). See | |
| 921 | + ROADMAP.md for entry points. | |
| 921 | 922 | |
| 922 | 923 | ## ADR-28: comma-list-of-tests `in`-RHS (positive unary test lists) |
| 923 | 924 | |
| @@ -976,9 +977,68 @@ | ||
| 976 | 977 | (`in_unary_test_lists_tck_0072`) covers the forms directly. |
| 977 | 978 | - **Consequence:** the comma-list / paren-list / `(=e)` test forms are in. Of the originally |
| 978 | 979 | planned follow-ups only this one was real; the ±∞ and range-promotion forms were retired |
| 979 | - by the TCK. Still deferred: reverse-bracket intervals `]a..b]` / `[a..b[` (the fatal | |
| 980 | - token-role case + the filter-free-endpoint refactor), unbounded `[1..]` / `[..10]` omitted | |
| 981 | - endpoints, and the opaque comparison-test value `(< 10)` in value position. | |
| 980 | + by the TCK. Reverse-bracket intervals `]a..b]` / `[a..b[` (the fatal token-role case + the | |
| 981 | + filter-free-endpoint refactor) are **now done (ADR-29)**. Still deferred: unbounded | |
| 982 | + `[1..]` / `[..10]` omitted endpoints, the opaque comparison-test value `(< 10)` in value | |
| 983 | + position, and `not(tests)` negation. | |
| 984 | + | |
| 985 | +## ADR-29: Reverse-bracket interval literals & range properties (DMN §10.3.2.6) | |
| 986 | + | |
| 987 | +- **Context:** ADR-27/ADR-28 left three range forms deferred; this clears two — the | |
| 988 | + reverse-bracket interval *spellings* `]a..b]` (exclusive lower, ≡ `(a..b]`) and `[a..b[` | |
| 989 | + (exclusive upper, ≡ `[a..b)`) — plus the **range property** accessors `.start` / `.end` / | |
| 990 | + `.start included` / `.end included` (DMN §10.3.2.6) that make them observable. The two | |
| 991 | + bracket surgeries are independent and were diagnosed differently by ADR-28: reverse-OPEN | |
| 992 | + is a *token-role* problem (lexer), reverse-CLOSE a *filter shift/reduce* (grammar). | |
| 993 | +- **Decision:** ship all three, each at its natural layer. | |
| 994 | + - **Reverse-OPEN `]a..b]` — lexer retag, not grammar.** Letting `]` *open* a primary | |
| 995 | + collides with its universal closer role: the empty list `[]` and a `[` followed by a | |
| 996 | + reverse-open `]` are not LR(1)-separable (one terminal, two shift targets — the fatal | |
| 997 | + case ADR-28 foreshadowed). So a final lexer post-pass (`mark_reverse_open`, alongside | |
| 998 | + `mark_instance_of`/`join_names`) retags an *opening* `]` to a distinct `RBracketOpen` | |
| 999 | + terminal. A `]` opens iff it is in value-expected position (the previous token does not | |
| 1000 | + complete a value) **and** a `..` follows at the same bracket depth before the group | |
| 1001 | + closes — so every list / filter / interval close and the empty list `[]` stay an | |
| 1002 | + ordinary `RBracket`. The grammar then admits `RBracketOpen Sum ".." Endpoint | |
| 1003 | + IntervalEnd`; no `]`-closer state is shared, the `build.rs` no-conflict gate stays | |
| 1004 | + green, and the parser stays fully lalrpop-generated (tokenisation is not parsing). | |
| 1005 | + - **Reverse-CLOSE `[a..b[` — filter-free endpoint, pure grammar.** Adding `[` as a third | |
| 1006 | + `IntervalEnd` bracket clashes with the `Postfix "[" Expr "]"` filter, which wants to | |
| 1007 | + shift a trailing `[` as a subscript. Resolve it with a filter-free high-endpoint | |
| 1008 | + nonterminal `Endpoint` (the `Sum` chain with the filter dropped from `EpPostfix`, base | |
| 1009 | + case reusing the shared `Primary`), used for every interval's high endpoint. With no | |
| 1010 | + `Postfix "[" …` item live there, a trailing `[` can only be the close — LR(1)-clean. | |
| 1011 | + Mirrors the `NbSum` precedent (ADR-28). Cost: an interval's high endpoint cannot itself | |
| 1012 | + end in a `[...]` subscript (`[a..xs[2]]`) — a shape no TCK case uses; the low endpoint | |
| 1013 | + and ordinary filters are unaffected. Composes with reverse-OPEN: `]a..b[` ≡ `(a..b)`. | |
| 1014 | + - **Range properties — a `member_access` arm.** A `Value::Range` reads `.start`/`.end` | |
| 1015 | + (the stored endpoint values, so an eventual unbounded endpoint surfaces as its null | |
| 1016 | + without special-casing) and `.start included`/`.end included` (= `!start_open` / | |
| 1017 | + `!end_open`). The two-word property names arrive pre-joined by the lexer (ADR-17). An | |
| 1018 | + unknown property is a value-null, mirroring `temporal::get_property` (a range *has* | |
| 1019 | + properties). No `Value`/AST change — `Value::Range` and the `RangeLit` AST already | |
| 1020 | + existed (ADR-27); this only wires the dot. | |
| 1021 | +- **Tests:** a structural reverse-bracket scan replaced the ingester's depth counter | |
| 1022 | + (`_value_range_brackets_ok`: pairs brackets by nesting without requiring types to match — | |
| 1023 | + FEEL intervals mix `[`/`(`/`]` — and resolves reverse roles positionally), and `.field` | |
| 1024 | + blanking now consumes joined multi-word member names (stopping at a keyword, like the | |
| 1025 | + lexer's join, so `a.b and c` keeps `and c`). Re-ingesting the three affected suites added | |
| 1026 | + **8** closed-loop cases: `0068` `(1..10] = ]1..10]` / `[1..10) = [1..10[` (notation | |
| 1027 | + equivalence), `1156` `range("]18..21]") = ]18..21]` / `range("[18..21[") = [18..21[` (the | |
| 1028 | + `range(string)` builtin also parses reverse brackets), and `0074`'s four `.time offset` | |
| 1029 | + properties. Suite **2720 → 2728**. Unit tests `reverse_open_bracket_intervals`, | |
| 1030 | + `reverse_close_bracket_intervals`, `range_properties` cover the forms directly. | |
| 1031 | +- **Consequence:** reverse-bracket intervals are first-class in value and `in` position, | |
| 1032 | + and range properties are readable. **0074's `range_*` decisions are boxed contexts** (4 | |
| 1033 | + `contextEntry` literals each) the literalExpression-only ingester does not read — same as | |
| 1034 | + 1130 — so the reverse-bracket *property* expressions (`]1..10].start included`) are | |
| 1035 | + covered by `range_properties` rather than ingested; lifting that is ingester-only work (a | |
| 1036 | + `<context>` extractor branch + structured expected-value parsing), no library change. | |
| 1037 | + Still deferred (the last two ADR-27 forms, both LR(1)-clean at the grammar — the block is | |
| 1038 | + semantic): unbounded omitted-endpoint ranges `[1..]` / `[..10]` (needs `Option` AST | |
| 1039 | + endpoints + eval treating omitted as ±∞, distinct from a null bound's "unknown") and the | |
| 1040 | + opaque comparison-test value `(< 10)` in value position (needs a new `Value` variant with | |
| 1041 | + reflexive, range-incompatible equality; ADR-28). `not(tests)` negation too. See ROADMAP.md. | |
| 982 | 1042 | |
| 983 | 1043 | ## Adding a wrapper — the host-binding contract |
| 984 | 1044 | |
modified ROADMAP.md +40 −17
| @@ -7,7 +7,7 @@ | ||
| 7 | 7 | without re-deriving the analysis. |
| 8 | 8 | |
| 9 | 9 | Coverage figures are case counts from `tools/ingest_tck.py` over the DMN-TCK |
| 10 | -compliance-level-3 suites. Today the fixture suite is **2720 cases / 86 files** | |
| 10 | +compliance-level-3 suites. Today the fixture suite is **2728 cases / 86 files** | |
| 11 | 11 | (`cargo test -p feel-core --test fixtures_test -- --nocapture`). |
| 12 | 12 | |
| 13 | 13 | --- |
| @@ -21,10 +21,11 @@ | ||
| 21 | 21 | `1156-range-function` 41 cases ingested, `0068-feel-equality` +3 (range equality), |
| 22 | 22 | `0072-feel-in` +8 (range membership) — suite 2598 → 2650; plus `1130-feel-interval`'s |
| 23 | 23 | 132-case relation truth table as a unit test (its decisions are boxed contexts the |
| 24 | -ingester does not read). **Comma-list-of-tests `in` now also shipped (ADR-28)** — | |
| 25 | -see below. **Still deferred:** reverse-bracket interval literals (`]a..b]` / `[a..b[`), | |
| 26 | -unbounded ranges (`[1..]`, `[..10]`), and the comparison-test-as-range *value* | |
| 27 | -(`(< 10)` in value position) — the last two reshaped by a TCK measurement (below). | |
| 24 | +ingester does not read). **Comma-list-of-tests `in` now also shipped (ADR-28)**, and | |
| 25 | +**reverse-bracket interval literals (`]a..b]` / `[a..b[`) + range properties (`.start` | |
| 26 | +/ `.end` / `.start included` / `.end included`) now shipped (ADR-29)** — see below. | |
| 27 | +**Still deferred:** unbounded ranges (`[1..]`, `[..10]`) and the comparison-test-as-range | |
| 28 | +*value* (`(< 10)` in value position) — both reshaped by a TCK measurement (below). | |
| 28 | 29 | |
| 29 | 30 | The grammar work needed **no LALR/LR rewrite**: a range literal is a `Primary` that |
| 30 | 31 | shares its `"[" Sum` / `"(" Sum` prefix with the list literal / grouping and branches |
| @@ -117,24 +118,46 @@ | ||
| 117 | 118 | One 0072 case skipped (`CROSS_TYPE_EQUALITY_SKIPS`); aligning cross-type equality |
| 118 | 119 | with the TCK's `false` is a separate ADR-level decision. |
| 119 | 120 | |
| 121 | +### Shipped — reverse-bracket intervals & range properties (ADR-29) | |
| 122 | + | |
| 123 | +Exactly the two independent surgeries forecast below, plus the property handler: | |
| 124 | + | |
| 125 | +- **Reverse-OPEN `]a..b]`** — the token-role case, resolved in the lexer as predicted (a | |
| 126 | + "stateful logos pass"): a post-pass `mark_reverse_open` retags an *opening* `]` to a | |
| 127 | + distinct `RBracketOpen` terminal. The role test is value-expected position + a forward | |
| 128 | + `..` scan at bracket depth — no in-grammar fork, no LR conflict. | |
| 129 | +- **Reverse-CLOSE `[a..b[`** — the filter-free high-endpoint nonterminal `Endpoint` (the | |
| 130 | + `Sum` chain minus the `Postfix [Expr]` filter), so a trailing `[` can only be the close. | |
| 131 | + Pure grammar. Composes with reverse-OPEN: `]a..b[` ≡ `(a..b)`. | |
| 132 | +- **Range properties** `.start` / `.end` / `.start included` / `.end included` — a | |
| 133 | + `Value::Range` arm in `member_access`. `0074-feel-properties` did **not** go green by | |
| 134 | + ingestion, though: its `range_*` decisions are *boxed contexts* the ingester does not | |
| 135 | + read (like 1130), so the property forms are covered by the `range_properties` unit test. | |
| 136 | + The ingester relaxation (reverse-bracket `..` scan + multi-word `.member` blanking) did | |
| 137 | + unlock **+8** related cases in `0068`/`1156`/`0074` (suite → 2728). | |
| 138 | + | |
| 120 | 139 | ### Still deferred |
| 121 | 140 | |
| 122 | -- **Reverse-bracket intervals** `]a..b]` / `[a..b[` — two independent surgeries: | |
| 123 | - reverse-OPEN `]…]` is the *fatal* token-role case (a stateful logos pass emitting a | |
| 124 | - distinct `RBracketValue` opener; no in-grammar fork is viable), reverse-CLOSE `[…[` | |
| 125 | - needs a filter-free endpoint nonterminal. Do both with the range-property handler so | |
| 126 | - `0074-feel-properties` goes green in one move rather than half-red. | |
| 127 | -- **`not(tests)` negation** — collides with the `not(…)` boolean built-in. | |
| 141 | +- **`not(tests)` negation** — collides with the `not(…)` boolean built-in. LALRPOP-solvable: | |
| 142 | + a `not`-free bare InRhs primary + a dedicated `not "(" Comma<UnaryTestElem> ")"` | |
| 143 | + production (test-negation is the correct FEEL unary-test semantics, so routing all `not(` | |
| 144 | + in `in`-position there loses nothing); needs a `UnaryTest::Not` eval representation. | |
| 128 | 145 | - **Unbounded omitted-endpoint ranges** `[1..]` / `[..10]` (distinct from a `null` |
| 129 | - endpoint) and the **value-position comparison-test value** `(< 10)` (above). | |
| 146 | + endpoint) — the grammar is LR(1)-clean (optional `Sum?` endpoints, disjoint lookaheads); | |
| 147 | + the work is `Option<Box<Expr>>` AST endpoints + eval treating an omitted side as ±∞ (vs a | |
| 148 | + `null` bound's three-valued "unknown"). | |
| 149 | +- **Value-position comparison-test value** `(< 10)` — grammar-clean (`"(" CmpOp Sum ")"`, | |
| 150 | + no token in `FIRST(Expr)` clashes); blocked on a new opaque `Value` variant with | |
| 151 | + reflexive, range-incompatible equality (ADR-28's measured semantics: `(<10) = (<10)` true, | |
| 152 | + `(<10) = (null..10)` false). | |
| 130 | 153 | |
| 131 | -### Entry points (for the reverse-bracket / value-test work) | |
| 154 | +### Entry points (for the remaining value-test / unbounded work) | |
| 132 | 155 | |
| 133 | 156 | - Grammar: [feel.lalrpop](crates/feel-core/src/feel.lalrpop) — the `InRhs` / |
| 134 | - `UnaryTestElem` / `NbSum` chain is the template; reverse brackets need the lexer-mode | |
| 135 | - opener + filter-free endpoint. | |
| 136 | -- Detector: `_balanced_bracket_group` / `_in_rhs_supported` in | |
| 137 | - [tools/ingest_tck.py](tools/ingest_tck.py) already accept the bracket test-lists. | |
| 157 | + `UnaryTestElem` / `NbSum` / `Endpoint` chains are the templates; unbounded ranges touch | |
| 158 | + `RangeLit` / `IntervalEnd`, the value-test `(< 10)` a new `Primary` alternative. | |
| 159 | +- Detector: `_balanced_bracket_group` / `_in_rhs_supported` / `_value_range_brackets_ok` | |
| 160 | + in [tools/ingest_tck.py](tools/ingest_tck.py). | |
| 138 | 161 | |
| 139 | 162 | --- |
| 140 | 163 | |