Pegof online

What is pegof?

Pegof is a command-line tool to format and optimize PEG grammars. It supports any grammar supported by PackCC parser generator. You can learn more about it in its GitHub repository.

How does it work?

Pegof parses peg grammar from input file and extracts it's AST. Then, based on the command it either just prints it out in nice and consistent format or directly as AST. It can also perform multi-pass optimization process that goes through the AST and tries to simplify it as much as possible to reduce number of rules and terms, which results in faster code in the generated parser.

How to use this site?

You can update the grammar in the input field and also the configuration on the right. The output and log fields will be automatically updated, unless auto-update is turned off. Note that this is just a demo, the real command-line tool provides more functionality, that would be difficult to show in the web environment.
Output type:
Add header:
Quotes:
Wrap threshold:

Verbosity:
Debug:
Skip validation:

Inline limit:
Optimizations:

Input:

Output:


        

Log: