Public repository: timo / feel

Reader

An interpreter of FEEL, written in Rust, with integrations for PostgreSQL, WASM, Lua, and Python.

docs: ADR-40 + ROADMAP/README — leading-dot literals & feel-constants suites

public

docs: ADR-40 + ROADMAP/README — leading-dot literals & feel-constants suites

ADR-40 in DECISIONS.md records the lexer widening (§10.3.2.3.1 / grammar
rule 35): leading-dot mantissa and exponent now lex; no grammar/AST/eval
or ingester change was needed.  Documents the three feel-constants fixtures
(0100 boolean, 0101 number, 0102 string) and the 2946 → 2958 suite delta.

ROADMAP.md: bump header to 2958 cases / 95 files; add shipped bullet for
ADR-40 alongside the ADR-38/39 entries.

README.md: bump "92 files, ~2946 cases" to "95 files, ~2958 cases"; add
0100/0101/0102-feel-constants to the ingested-dirs prose.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Changeset384d46962fedab1cc101b6e09087178a95c67265
Author (claimed)Timo Stolz <timo.stolz@gmail.com>,
Parents906eb8bcb650
Children
Pushlog
by timo via ssh

modified DECISIONS.md +38 −0

@@ -1910,3 +1910,41 @@
19101910
   as part of the 92-fixture suite. Unit tests `typed_formal_params_parse_and_eval`
19111911
   and `typed_params_closure_and_currying` in `lib.rs::function_tests`. **Suite
19121912
   2915 → 2946.**
1913
+
1914
+## ADR-40: Leading-dot & exponent number literals (§10.3.2.3.1 / grammar rule 35) + 0100/0101/0102-feel-constants
1915
+
1916
+- **Context:** FEEL grammar rule 35 allows a numeric literal to begin with a dot
1917
+  (`".872"`) and to carry an optional exponent (`"1.2e3"`). The compliance-level-2
1918
+  suite `0101-feel-constants` tests exactly these forms (`.872`, `-.872`). The
1919
+  ingester's `fits_slice_grammar` predicate already admitted all three feel-constants
1920
+  suites (no free names), but the engine couldn't evaluate `.872` because the logos
1921
+  lexer regex only covered digit-led mantissas without exponents.
1922
+
1923
+- **Decision:** Widen the `Num` token regex in `lexer.rs` to match FEEL rule 35 in
1924
+  full:
1925
+
1926
+  ```text
1927
+  ([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?
1928
+  ```
1929
+
1930
+  The leading-dot branch (`\.[0-9]+`) requires at least one digit after the dot, so it
1931
+  never overlaps with `..` (DotDot, two chars) or a lone `.` (Dot, one char); logos's
1932
+  maximal-munch resolves every case without a priority annotation. Negatives stay as
1933
+  unary minus over the literal (consistent with `0099-arithmetic-negation`). No
1934
+  grammar/AST/eval changes were needed — `f64::from_str` already handles these forms.
1935
+  No ingester change was needed — the grammar-slice predicate already accepted them
1936
+  (ADR-7 in reverse: the engine widened to catch up to what the predicate admitted).
1937
+
1938
+- **Fixtures ingested:**
1939
+  - `0100-feel-constants` (compliance-level-2) — 2 cases: `true`, `false` [boolean,
1940
+    exact]. Suite 2946 → 2948.
1941
+  - `0101-feel-constants` (compliance-level-2) — 6 cases: `.872`, `-.872`, `50`,
1942
+    `-50`, `125.4321987654`, `-125.4321987654` [number, f64_epsilon, epsilon=1e-8].
1943
+    Suite 2948 → 2954.
1944
+  - `0102-feel-constants` (compliance-level-2) — 4 cases: `"foo bar"`,
1945
+    `"šomeÚnicodeŠtriňg"`, `"横綱"`, a long ASCII string [string, exact]. Suite 2954
1946
+    → 2958.
1947
+
1948
+- **Unit tests** (`number_literals_rule35` in `lib.rs`): direct coverage of `.872`,
1949
+  `-.872`, `1.2e3`, `1E-3`, `.5e2` so the regex widening has non-fixture verification.
1950
+  **Suite 2946 → 2958.**

modified README.md +3 −2

@@ -137,7 +137,7 @@
137137
 `context put` *overloads* whose name is absent from the single-row table
138138
 (`date(from: …)`, `context put(…, keys: …)`; see `NAMED_ARG_OVERLOAD_SKIPS`).
139139
 
140
-The fixtures used by the test (92 files, ~2946 self-contained cases) are
140
+The fixtures used by the test (95 files, ~2958 self-contained cases) are
141141
 regenerated by pointing the script at each TCK dir, e.g.:
142142
 
143143
 ```sh
@@ -158,7 +158,8 @@
158158
   -o crates/feel-core/tests/fixtures/0070-instance-of.json
159159
 ```
160160
 
161
-The other ingested dirs include `0105-feel-math` (compliance-level-2),
161
+The other ingested dirs include `0100/0101/0102-feel-constants` (compliance-level-2,
162
+boolean/number/string literal constants; ADR-40), `0105-feel-math` (compliance-level-2),
162163
 `0064`/`0065`/`0066` (and/or/not), `0071-feel-between`, `0075-feel-exponent`,
163164
 `0099-arithmetic-negation`, the single-word `feel-*-function` dirs (ADR-15), and
164165
 the multi-word string/list/context dirs reached via the lexer name-join (ADR-17:

modified ROADMAP.md +7 −1

@@ -7,7 +7,7 @@
77
 without re-deriving the analysis.
88
 
99
 Coverage figures are case counts from `tools/ingest_tck.py` over the DMN-TCK
10
-compliance-level-3 suites. Today the fixture suite is **2890 cases / 88 files**
10
+compliance-level-3 suites. Today the fixture suite is **2958 cases / 95 files**
1111
 (`cargo test -p feel-core --test fixtures_test -- --nocapture`).
1212
 
1313
 ---
@@ -256,6 +256,12 @@
256256
   all the way through `FnDef` → `Closure` → `bind_params` where an arg that
257257
   doesn't conform to its declared type coerces the call result to null. BKMs
258258
   inlined as function literals in the ingester. **Suite 2915 → 2946.**
259
+- **Leading-dot & exponent number literals (§10.3.2.3.1 / grammar rule 35)** ✅ **shipped (ADR-40).**
260
+  `0100/0101/0102-feel-constants` (compliance-level-2) — 12 cases: 2 boolean, 6
261
+  number, 4 string. The only engine gap was the lexer's `Num` regex, which did not
262
+  allow a leading-dot mantissa (`.872`) or an exponent (`1.2e3`); widened to full
263
+  rule-35 coverage. No ingester or grammar change needed — `fits_slice_grammar`
264
+  already admitted these expressions. **Suite 2946 → 2958.**
259265
 - **Emoji / non-XID names** as bare context keys (`{🐎: "bar"}`,
260266
   `0083-feel-unicode`) — the lexer accepts XID identifiers only; 2 cases skipped
261267
   (`NON_XID_NAME_SKIPS`).