parsertl-playground

parsertl lexertl playground

You can try it here https://mingodad.github.io/parsertl-playground/playground/ .

A web based playground for https://github.com/BenHanson/parsertl14 and https://github.com/BenHanson/lexertl14 based on https://github.com/BenHanson/gram_grep .

The playground website is based on https://yhirose.github.io/cpp-peglib/ and also with modifications based on https://chrishixon.github.io/chpeg/playground/ .

The playground save the grammar and the input in the local storage when you click Parse.

The playground has the following main elements:

The availabel debugging options are:

This project can also be built as a command line tool (see build.sh) then you can use it to check grammar/input on your disc:

./parsertl-playground
usage: ./parsertl-playground [options] grammar_fname input_fname
options can be:
-dumpil        Dump input lexer
-dumpiptree    Dump input parser tree
-dumpiptrace   Dump input parser trace
-dumpgl        Dump grammar lexer
-dumpgptree    Dump grammar parser tree
-dumpgptrace   Dump grammar parser trace
-dumpglsm      Dump grammar lexer state machine
-dumpgsm       Dump grammar parser state machine
-dumpAsEbnfRR  Dump grammar as EBNF for railroad diagram
-dumpAsYacc    Dump grammar as Yacc
-pruneptree    Do not show empty parser tree nodes
-verbose       Show several metrics for debug

The grammar used internally to parse the user grammar is this one playground-master.g the grammar has 4 sections:

/*Grammar header*/
%%
/*Grammar rules*/
%%
/*Lex header*/
%%
/*Lex rules*/
%%

The first two sections are equivalent to yacc/bison format and the other two sections are equivalent to lex/flex format.

Related projects: