Coder Social home page Coder Social logo

regex's Introduction

Regex

This is a very simple regular expression engine, created for learning purposes. It supports parantheses, the Kleene star, and the OR operator.

It works by turning a regular expression into a λ-NFA, turns that into a simple NFA, then into a DFA, then minimizes the DFA. A word is then matched by the regular expression if it's recognized by the resulting DFA.

The package is written in golang and it doesn't have any external dependencies. Also, it doesn't rely on the regexp package.

What's this all about

If you want to learn about Finite Automata, this package should be hacking material.

How do I use this

go run lfa.go -- it will prompt you for a regular expression and a word to match against that expression.

It then prints whether the word matches or not, and also prints out the minimized DFA as a directed graph with characters on edges.

You can use UTF-8 for the word/regex, though don't use the lambda character.

Example regular expressions:

a*b
(a|b)*c
(word)*|anotherword

regex's People

Contributors

gabipurcaru 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.