github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
12.29k stars 4.26k forks source link

W3C BNF #5590

Open Crissov opened 3 years ago

Crissov commented 3 years ago

Language name

Some variants of Backus-Naur Form (BNF) are already supported. As noted in #3075, there are significant difference between ISO EBNF and W3C EBNF. Only the former is properly supported yet.

Side note: the latter should really be known as “WEBNF”. Missed opportunities.

URL of example repository

Specs and issues in @w3c use EBNF frequently.

URL of syntax highlighting grammar

Most popular extensions

—, .ebnf and .bnf probably.

Files with only formal grammar in them are rare. Code blocks in Markdown/GFM are way more common.

Detected language

ISO EBNF

Alhadis commented 3 years ago

There's a zillion different *BNF variants, many of which overlap. Attempting to differentiate between them—and I speak from experience—is an exercise in futility. The fact that many authors use EBNF, BNF, and sometimes even ABNF interchangeably should tell you that even if this wasn't outside Linguist's scope, it'd be impossible to implement.

As it stands, the grammar used for highlighting *BNF files on GitHub does its best to cope with the myriad of real-world variations and ad hoc extensions that authors are prone to using. Because BNF is ultimately a notation more than a language or file-format, it's impossible for a static expression-based grammar to accommodate everything.