add NFA/DFA oracle tests#194
Open
hhugo wants to merge 4 commits into
Open
Conversation
3 tasks
This was referenced Apr 6, 2026
Member
|
@hhugo You should have the ability to commit such things on your own at this point... |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy lex/{cset,lexgen,syntax,table}.{ml,mli} verbatim from the OCaml
compiler sources. These provide an independent TDFA implementation
used as a reference oracle for testing sedlex's tagged DFA.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- ocamllex_oracle: converts Ir.t to ocamllex's regex AST, compiles with Lexgen.make_dfa, and simulates the resulting automata - sedlex_oracle: runs both ocamllex and sedlex DFA simulators, compares results, reports errors on any divergence - Add FIXME comment on add_node documenting the known epsilon-closure tag bug with overlapping Star/Plus and captures Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hand-written tests cover captures, multi-rule, backtracking, bounded repetition, complement, subtraction, intersection, or-patterns, and the known Star/Plus overlap limitation. QCheck tests (50k iterations) fuzz single-rule and two-rule patterns with random captures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sedlex.compilerlibrary: MoveSedlex,Cset(formerlySedlex_cset) out of the PPX into a standalonesedlex.compilerlibrary. Absorbsedlex.utilsinto it. Non-PPX code (tests, tools) can now depend on the regexp/DFA engine without pulling in ppxlib.Cset.mem: Code point membership test for character sets.sedlex_oraclelibrary with a per-thread NFA simulator that serves as ground truth for the DFA. Compares acceptance and tag/binding values between NFA and DFA, printingFIXMEon mismatches. Includes hand-written expect tests and QCheck property-based tests. Documents the known FIXME inadd_nodewhere the shared tag-op list causes wrong captures for overlapping Star/Plus + as-binding patterns.Test plan
dune buildsucceedsdune runtestpasses (all existing tests + new oracle tests)FIXMEprefix🤖 Generated with Claude Code