Coder Social home page Coder Social logo

re2epsnfa's Introduction

RE2EPSNFA: A tranform function to translate RE to Epsilon-NFA (Epsilon-Nondeterministic finite automaton)

GitHub license GoDoc Build Status

image

What is this package

re2epsnfa (Regular Expression to Eplison-NFA) will help you to convert regular expression string to epsilon-NFA object.

####The convert rule base on three simple rule:

image

union: ex: A union B

image

concatenation: ex: A concatenation B

image

closure: ex: Closure(A)

What is Epsilon-Nondeterministic finite automaton

ε-NFA: Epsilon-Nondeterministic finite automaton (so call:Nondeterministic finite automaton with ε-moves)

In the automata theory, a nondeterministic finite automaton with ε-moves (NFA-ε)(also known as NFA-λ) is an extension of nondeterministic finite automaton(NFA), which allows a transformation to a new state without consuming any input symbols. The transitions without consuming an input symbol are called ε-transitions or λ-transitions. In the state diagrams, they are usually labeled with the Greek letter ε or λ.

(sited from here)

Installation and Usage

Install

go get github.com/kkdai/re2epsnfa

Usage

Following is sample code to implement a epsilon-NFA automata diagram as follow:

package main

import (
    "github.com/kkdai/re2epsnfa"
)

func main() {

	trans := NewRe2EpsNFA("(0+1.0)*.(e+1)")
	trans.StartParse()
	enfa := trans.GetEpsNFA()
	enfa.PrintTransitionTable()

}

Inspired By

Project52

It is one of my project 52.

License

This package is licensed under MIT license. See LICENSE for details.

re2epsnfa's People

Contributors

kkdai avatar golint-fixer 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.