Skip to content

Implement named capture group.#175

Draft
hhugo wants to merge 12 commits intoocaml-community:masterfrom
hhugo:share-cell
Draft

Implement named capture group.#175
hhugo wants to merge 12 commits intoocaml-community:masterfrom
hhugo:share-cell

Conversation

@hhugo
Copy link
Contributor

@hhugo hhugo commented Feb 8, 2026

This work was produce with the help of the Claude AI assistant.

Draft , as I plan to split it in 6 smaller PRs, starting with #174, I plan to review and understand implementations before opening individual PRs.

Here is the plan:
A chain of 5 PRs that implement efficient named pattern.

I believe the feature is usable with 1 + 2 already, as I expect constant offsets to be the most common.

Replace #112
Fix #5, #102

hhugo and others added 6 commits February 9, 2026 12:21
Tags on self-loops that also appear on all entering transitions are
removed from those transitions and emitted as Set_prev on exit
transitions. The runtime set_mem_prev records pos-1 (position before
the consumed char), turning O(n) tag writes in loops into O(1) on exit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tags with identical occurrence signatures (same presence in init_tags
and same set of transitions) are coalesced to share a single memory
cell. The PPX remaps Tag references through the compiler's tag_map
after compilation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Non-interfering cells from different rules share the same physical
memory slot. Uses forward-reachability analysis and greedy graph
coloring: cells conflict if they belong to the same rule, span
multiple rules, or have overlapping forward-reachable state sets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Named capture groups

1 participant