Welcome to the BNF Playground


A place to design and test context free grammars using Backus-Naur Form or Extended Backus-Naur Form


Syntactic Sugar:

Life Hacks:

Enter your BNF (or EBNF) below.
Compile BNF
Test a string below!
Generate a String

Are you sure you want to logout?

Will miss you.

Once you compile your BNF, you can test strings for validity by typing them in the box above. Whatever the FIRST definition of your BNF is is what will be tested. You can easily test different terms of your BNF by setting the top line to: <totest> ::= <termToTest>. Green indicates a valid string; red is invalid.

You can also generate random strings for any term in your definition. Note that the validitity indicator (green or red background) still only indicates the validity of the topmost definition.

Save BNF as URL