GithubHelp home page GithubHelp logo

grepy's Introduction

grepy

a Grep like utility that utilizes NFAs (Nondeterministic Finite Automatas) and DFAs (Deterministic Finite Automatas). This utility takes in a regex, and parses strings against the regex using a DFA which it creates on the fly. It also creates an NFA. (NOTE: NFAs use ~ to represent epsilon) These DFAs are then used to test if a set of given strings match the original regex.


Instructions

Setup

  1. Clone or download the main branch of the grepy repository.
  2. Inside of the downloaded files, you will find a folder titled "Production Version". This is where the working product is.
  3. In this directory, add your regex file in a .txt format. On the first line, write the regex you would like to use wrapped in a ^ and $ on either side. (ex. a+b would look like ^a+b$). If you choose, you may also put strings to test on the next lines, one per line. For reference, refer to the other regex files which are in the folder already.
  4. If you would like to specify the filenames of the outputted DFA and NFA, create the files using the extension .DOT.
  5. Ensure that all of your files are in the "Production Version" directory before continuing.

Execution

  1. Before continuing, ensure that your computer is equipped with Java Runtime Environment and that it is accessible from your terminal of choice, as it will be necessary for continuing. (hint: to check if you have it installed, type java --version to check.)
  2. navigate to the "Production Version" directory within your terminal or command prompt.
  3. Start by typing the command java -jar grepy.jar, but do not press enter yet.
  4. If you have created your own DFA and NFA files, add the DFA .DOT file name first followed by the NFA .DOT file name. Finally add the file name of your regex .txt file.
  5. If you did not create DFA and NFA files, just add the regex .txt file.
  6. So, your execution command will look like one of the two following commands:

java -jar grepy.jar DFAFILE.DOT NFAFILE.DOT regex.txt

Or

java -jar grepy.jar regex.txt


  1. Once you run the command, the program will generate the state machines, as well as attempting to parse any strings that were in the regex file.
  2. you can choose to continue to try other strings by simply inputting them as specified by the interface, or typing quit() to end the program.
  3. To view the state machines, the easiest way to create them would be to copy the contents of each file, and paste them into this site.

grepy's People

Contributors

salcosser avatar

Watchers

Michael Gildein avatar  avatar

grepy's Issues

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.