Skip to content

Conversation

@Seven-Streams
Copy link

In this PR:

  • refactor the tests.
  • fix the bugs in AddFSM and SimplifyEpsilon
  • Enable the developing XGrammar to be compiled successfully, and it can pass all the fsm tests.

Seven-Streams and others added 19 commits April 28, 2025 13:41
At present, the FSM class can only build a FSM from a string. This PR
offers a basic RegexToFSM function.
These regex grammars are supported:
- Strings. For instance, `RegexToFSM("abc")` will build a FSM to accept
"abc".
- Character classes. For instance, `RegexToFSM("[a-z]")` will build a
FSM to accept characters from 'a' to 'z'.
- Repeatation(`*`, `+`, `?`, `{m}`, `{m, n}`).
- Union. (`|`).
Moreover, some basic optimization algorithms are implemented, which can
help to simplify the state machine:
- `ToDFA()`.(Powerset construction)
- `MinimizeDFA()`(Hopcraft Algorithm).
- `SimplifyTransition()`(Xgrammar node merging, type I)
- `SimplifyEpsilon()`(Xgrammar node merging, type II)

---------

Co-authored-by: Yixin Dong <[email protected]>
…g-dispatch' into dev/5.26/enhance_tag_dispatch
@Ubospica Ubospica merged commit 9441746 into Ubospica:main-dev/2025-05-26-enhance-tag-dispatch May 29, 2025
@Ubospica
Copy link
Owner

Thanks! @Seven-Streams

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