Skip to content

How I Did This

Egbert edited this page Feb 16, 2025 · 9 revisions

How I broke down NFTABLES into VimL/vimscript syntax

The VimL/vimscript syntax programming was accomplished by doing the following steps:

  1. Converting nftables Yacc (parser_bison.y) file into a grammar file.
  2. Processing dotgraph file into EBNF-W3C format.
  3. Creating Railroad Diagram from EBNF-W3C into nftables.html

Converting nftables Bison file into EBNF

Visit the online Grammar Convertor website at https://www.bottlecaps.de/ebnf-convert/

Copy entire content of nftables/src/parser_bison.y into the "Input Grammar" textbox.

Ensure that all checkboxes and settings for below are:

  • Direct recursion elimination: checked
  • Factoring: checked
  • Inline single-string nonterminals: checked
  • Keep references to epsilon-only nonterminals: checked
  • Target format: EBNF

Click on "Convert" button.

In the "W3C-style grammar" textbox, copy entire text content into a file (nftables.ebnf-w3c).

You get this (screenshot of a) railroad diagram of nftables.

A much larger PNG image file of the nftables syntax which is not viewable here, but from your cloned repository of this vim-nftables.

Clone this wiki locally