Skip to content

Conversation

Seven-Streams
Copy link
Collaborator

This PR adds a script to test the code coverage.

Seven-Streams and others added 13 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]>
Copy link
Collaborator

@Ubospica Ubospica left a comment

Choose a reason for hiding this comment

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

Could you add a developer_guide.rst under docs/howto with a section about code coverage tool? Contents include

  1. How to use (cmake flags, script)
  2. Don't aim for a high code coverage rate, but good functionality coverage. Especially, complex functionality needs more tests which is not reflected in code cov rate.

@Seven-Streams
Copy link
Collaborator Author

got it

@Ubospica Ubospica merged commit b87ed7f into mlc-ai:main Jun 8, 2025
38 checks passed
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