Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>BBNF Language SupportNew to Visual Studio Code? Get it now.

BBNF Language Support

Michael Babb

|
2 installs
| (0) | Free
Formatting, intellisense, and syntax highlighting for BBNF lang.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

BBNF lang

image

Better Backus-Naur Form


An extension to EBNF that allows for the definition of context-free grammars. Used within the parse-that parser generator. Herein is the VS Code language support for BBNF.

Features

  • Syntax highlighting 🌈
  • Code formatting 🎨
  • Intellisense 🧠
  • Folding regions 📦
  • Error squiggles for various malformations 🚫
  • Left-recursion detection & elimination ⚙️
  • Topological rule sorting 📐
  • SOON - Grammar transformation 🧪
    • Converting to EBNF, ABNF, etc.

Intellisense, syntax highlighting & error reporting

Code formatting

Powered by prettier and prettier-plugin-bbnf. Takes this:

And converts it to this:

Left-recursion detection & elimination; Topological rule sorting

If chosen, the extension will automatically detect and eliminate left-recursion in your grammar. It will also sort your rules topologically, so that rules that depend on other rules are defined after the rules they depend on. This is useful for the parser generator, which will generate a parser that is more efficient if the rules are defined in this order.

About

Sort of a real-world example of a modern VS Code extension using the newly formulated LSP (Language Server Protocol) and the new VS Code API. That notwithstanding, this is still fairly useful for anyone looking to write a grammar using a BNF-like syntax.

Created because I was tired of writing grammar files with the fairly cumbersome EBNF syntax. And moreover had no way of validating, formatting, or otherwise working with my grammar files. VS code's got me spoiled 😭.

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft