Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noir ZK Regex #85

Draft
wants to merge 31 commits into
base: main
Choose a base branch
from
Draft

Noir ZK Regex #85

wants to merge 31 commits into from

Conversation

jp4g
Copy link

@jp4g jp4g commented Feb 9, 2025

No description provided.

olehmisar and others added 22 commits September 19, 2024 14:13
…aw setting.

The substrings are returned as BoundedVec since we don't know their exact length upfront, but we know they're not longer than N.
To support both settings (decomposed and raw) we have to use `substring_ranges` instead of `substring_boundaries`.
…gex and input. This fix makes sure this is supported.

Changes:
- regex_match returns a Vec of substrings instead of an array with known length
- per state where substrings have to be extracted; add the byte either to a new substring or an already started one

Note that substr_count is used to extract the correct "current" substring from the Vec. This is a workaround - first implementation was using `pop` but this gave an error.
For caret anchor: Mark beginning of input byte array with 255, which makes the check for caret anchor (ˆ) works. Note that ^ is only taken into consideration in the decomposed mode.
…states reachable from state 0.

Substrings only get saved when they are part of a path that doesn't reset.
@jp4g jp4g requested a review from shreyas-londhe February 9, 2025 07:01
@jp4g jp4g marked this pull request as draft February 9, 2025 07:01

// "Previous" state
let mut s: Field = 0;
s = table[255];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Why is the starting state set to table[255]? Shouldn't it be set to 0

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes the check for caret anchor (^) work, see this commit.

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.

4 participants