Code Monkey home page Code Monkey logo

mingodad / parsertl-playground Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 0.0 4.56 MB

A web based playground for parsertl/lexertl

License: Boost Software License 1.0

C++ 24.13% POV-Ray SDL 1.15% Yacc 0.26% GAP 72.27% Shell 0.02% HTML 0.08% JavaScript 0.49% CSS 0.03% Ada 0.08% Awk 0.02% C 0.07% Java 0.21% LSL 0.62% Lua 0.04% Pascal 0.04% Tcl 0.21% C# 0.10% Visual Basic .NET 0.03% jq 0.01% WebAssembly 0.11%
bnf-parser ebnf-syntax lalr-parser lexer-parser parser bison c-plus-plus flex grammar lalr1

parsertl-playground's Introduction

parsertl lexertl 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:

  • A select labeled Examples to choose one available example to start with.
  • A select labeled Generate to optionally export Yacc/EBNF (for railroad diagrams).
  • A button labeled Parse to build/execute the parser/grammar in the top left side editor over the input in the top right side editor.
  • A bottom right side area to display info about the grammar (errors are clickable links to jump to line in the editor).
  • A bottom left side area to display info about the input source parsing results (errors are clickabel to jump to line in the editor).
  • A center left side foldable read only editor to show debug info about lexing/parsing the grammar or the input.

The availabel debugging options are:

  • Input parse tree pruned
  • Input parse tree full
  • Input lexer dump
  • Input parse trace
  • Grammar parse tree pruned
  • Grammar parse tree full
  • Grammar lexer dump
  • Grammar parse trace
  • Grammar lexer state machine
  • Grammar parse state machine

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:

parsertl-playground's People

Contributors

mingodad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.