Simple syntax highlighting for BNF (Backus-Naur Form) grammar files in Neovim.
{
"adamkleo/bnf-syntax"
}use "adamkleo/bnf-syntax"The plugin automatically detects .bnf files and applies syntax highlighting. No configuration required.
Example BNF syntax that will be highlighted:
<expression> ::= <term> | <expression> "+" <term>
<term> ::= <factor> | <term> "*" <factor>
<factor> ::= "(" <expression> ")" | <number>
Optionally customize the filetype and extension:
require("bnf-syntax").setup({
filetype = "bnf",
extension = "bnf"
})The extension option is used to match files ending with the chosen extension. The filetype option sets the filetype of the matched files. By default, these values are both "bnf"
MIT
