Giter VIP home page Giter VIP logo

grammar2table's Introduction

Grammar2Table

Java program that takes a grammar as an input and gives a table as an output.

Documentation

You will need Java to be installed in order to use the program.

To run this program on a grammar file, you first need to compile it with compile for Windows or ./compile for Linux. Then you can use the command g2t <file> [options] for Windows or ./g2t <file> [options] for Linux. You can generate a jar file using build for Windows or ./build for Linux. For Linux only, you can also generate a .deb package file using ./mkpkg. Note that you may need to use sudo to execute the commands.

Terminals and non-terminals are automatically determined. They can be any symbol apart from the end of file symbol $ Non-alphanumerical symbols are automatically determined to be terminals, and they are always separated. Empty words (epsilon) are written as ^

Options

  • -s, --show-states: Shows all states of the finite state machine
  • -n, --no-table: Prevents the table from exporting
  • -q, --quiet: Quiet mode, only show errors
  • -c, --compact: Merge states to remove doubles when no ambiguity
  • -o<name>, --output=name: Output file name (default: <file>)
  • -p[N], --optimize-csv[=N]: Optimize CSV file with level N (default: 1)

Optimize CSV

  1. No optimization
  2. Remove ERROR actions
  3. Remove leading commas and state number
  4. Replace action type by a single character, replace arrow by equals and removes "I" in states
  5. Replace REDUCE action rules by the non-terminal to reduce to and the number of stack pop to do
  6. Remove first space after the first letter and replace non-terminals by their index at the top

Syntax

// S, NonTerm and OtherNonTerm are automatically detected to be non-terminals
# a, b, c, d, e, f, \= and + are automatically detected to be terminals
/*
With an anti-slash,
you can escape the following characters: | ; = \
*/

S = a NonTerm b | c;
NonTerm = d NonTerm | e \= a OtherNonTerm;
OtherNonTerm = f NonTerm + e | ^;

grammar2table's People

Contributors

noasenesi avatar

Stargazers

 avatar

Watchers

 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.