Skip to content

Conversation

@ssam18
Copy link

@ssam18 ssam18 commented Nov 17, 2025

I noticed the grammar README documentation was outdated. It stated that rule names must be 'dashed lowercase words', but when I looked at the examples like c.gbnf, I saw it uses dataType with an uppercase letter.

After checking the discussion in #7720, it's clear the parser actually supports much more flexibility than the docs suggested:

  • Uppercase and lowercase letters
  • Numbers
  • Both dashes and underscores

This PR updates the documentation to accurately reflect what the parser actually supports. The examples work fine - the docs just needed updating to match reality.

Changes:

  • Updated the 'Non-Terminals and Terminals' section to list all supported characters
  • Added examples showing the flexibility (dataType, UPPER-CASE, rule_123)

This should help people understand they have more flexibility when naming their grammar rules.

Fixes #7720

The documentation stated that non-terminal symbols must be 'dashed lowercase
words' like 'move' or 'check-mate', but the actual parser supports much more
flexibility. Rule names can include:
- Uppercase letters (e.g., dataType, UPPER-CASE)
- Numbers (e.g., rule123)
- Both dashes and underscores

This was discovered when c.gbnf used 'dataType' with an uppercase letter,
which works correctly despite the documentation saying otherwise. Updated
the docs to accurately describe the parser's capabilities rather than
restrict them.

Fixes ggml-org#7720

Signed-off-by: Samaresh Kumar Singh <ssam3003@gmail.com>
@ssam18
Copy link
Author

ssam18 commented Nov 17, 2025

I was writing my own grammar and kept getting confused by the documentation saying I had to use lowercase-dashed names, but then I saw the c.gbnf example using 'dataType'. Took me a while to realize the parser is actually way more flexible than the docs claimed. Hope this update helps others avoid the same confusion

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.

Bug: Grammar readme seems incorrect

1 participant