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

LALR grammars #158

Open
joc-proxem opened this issue Jan 17, 2025 · 1 comment
Open

LALR grammars #158

joc-proxem opened this issue Jan 17, 2025 · 1 comment

Comments

@joc-proxem
Copy link

I have a grammar that is successfully used with a Lark parser in 'lalr' mode. In this configuration, parsing is very fast.
When translated as a GBNF grammar, xgr.fill_next_token_bitmask may take several seconds on some states.
My guess is that XGrammar does not implement LALR states merging (Lark parser is slow as well when not in 'lalr' mode). Is it something that is planned ?

@Ubospica
Copy link
Collaborator

Hi @joc-proxem , thanks for the question! XGrammar does not implement LALR for now. The benefit is it can parse non-lalr grammar, although it will make parsing some lalr grammar slow. We now have a plan to enhance the grammar parser. Please stay tuned!

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

No branches or pull requests

2 participants