Welcome to Context-Free Grammar Explorer

Please start by clicking the top bar to open the menu and chose one of the grammar input methods. There is a handful of grammar examples located in the section for text input, meant to demonstrate some of the algorithms. You can even store a grammar in an HTTP link and share it with others.

Input format:

  • Symbols (terminals and nonterminals) are words over the ASCII letters (a-z, A-Z), digits (0-9), some special characters ( _ + - * / ( ) [ ] ’ : ; ! ? @ $ # ); no whitespaces.
    • Terminals start with a lowercase letter, digit or a special character, nonterminals start with an uppercase letter (A-Z).
    • Symbols can optionally be indexed by appending the forward slash character ( / ) and any non-empty string of allowed characters.
  • Words consist of terminals/nonterminals, each separated by at least one space character; alternatively use eps for empty word

You can immediatelly see which normal forms your grammar conforms to. Then you can choose one of the algorithms in the menu.

  • Use the list of steps or buttons to navigate through the algorithm visualization. There are buttons to:
    • see the next/previous step
    • proceed to the next/previous task, skipping substeps
    • go to the end/beginning
  • You can either save the final grammar/parse table, save any of the intermediate steps, or discard the changes entirely by leaving the section

Please see the thesis for more information, link is on the project's GitHub page.

math-like brief JSON HTTP link Save

Useful grammar examples:

  • name - description
Input word: Parse

The CYK algorithm used to parse the input requires a grammar in strict Chomsky normal form. Please modify the grammar yourself or convert it automatically using the option in menu.

Input word: Parse with CYK

CYK parsing in progress...

The input word is generated is not generated by this grammar. Display random parse tree

Leftmost derivation:

Rightmost derivation:

N =
T =
P =
S =
=