Skip to content

avoid quadratic rejection in F32.read - #1625

Merged
Lorenzobattistela merged 2 commits into
bendlang:mainfrom
toprameen:avoid-f32-read-backtracking
Oct 16, 2026
Merged

Lorenzobattistela merged 2 commits into
bendlang:mainfrom
toprameen:avoid-f32-read-backtracking

Conversation

@toprameen

Copy link
Copy Markdown
Contributor

F32.read’s JS matcher allows two digit repetitions to consume the same integer when the optional decimal point is absent. A long digit string followed by an invalid character causes quadratic rejection. Require the decimal point before the second repetition, preserving the accepted grammar and existing rounding behavior.

Add a focused regression that constructs 100,000 digits followed by x at runtime. It exceeds the test runner’s existing five-second limit before the fix and returns None afterward.

Local checks: the regression and existing whitespace, rounding and formatting fixtures pass through source/compiled CLIs, emitted Bun/Node and native C on macOS arm64. TypeScript diagnostics match baseline.

The repository gate remains blocked by the existing compiler token overage: main is 64,092/64,000; this fix adds two tokens, reaching 64,094.

@toprameen
toprameen marked this pull request as ready for review October 16, 2026 20:25
@Lorenzobattistela Lorenzobattistela self-assigned this Oct 16, 2026
@Lorenzobattistela
Lorenzobattistela merged commit 3f9c40e into bendlang:main Oct 16, 2026
1 of 2 checks passed
nicolas-abril added a commit to nicolas-abril/bend that referenced this pull request Oct 19, 2026
comp.ts keeps this branch's structure, with upstream's changes ported in:
bendlang#1615's frame-slot write-back in bind_pop; bendlang#1617's named memo functions
(open_of, spine_of, uses_of), per-file literal steps keyed by string, and
lay_at memoized per type key (FL.ty_opens, keyed by ty_key); bendlang#1625's
F32.read regex; bendlang#1628's string_contains.

bendlang#1617's per-def PROBES reset is left out: here probes and the term caches
live as long as the file and units emit again across sweeps, so a reset
would reuse probe indices still held in FL.opens and FL.uses.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Lorenzobattistela Lorenzobattistela mentioned this pull request Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants