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

Json grammar doesn't allow array #102

Open
Saibo-creator opened this issue Oct 1, 2024 · 0 comments
Open

Json grammar doesn't allow array #102

Saibo-creator opened this issue Oct 1, 2024 · 0 comments

Comments

@Saibo-creator
Copy link
Collaborator

https://github.com/epfl-dlab/transformers-CFG/blob/main/examples/grammars/json.ebnf#L6

I just realise that the grammar here for json only allows json object at root level.

In fact, json grammar accepts array and other atomic values like string or number at root level.

So a string itself is a valid json.

Here is the spec of JSON standard: https://www.json.org/json-en.html

Probably we just need to replace the root grammar rule json::=object to json::= value and fix the potentially impacted tests.

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

1 participant