Git Product home page Git Product logo

nfa's Introduction

Convert regular expressions into FAs

Automata Program NFA construction

Rule 1: There is an FA that accepts any symbol of Σ and there is an FA that accepts ε. If x is in Σ then give an FA that accepts x Give an FA that accepts ε.

Rule 2: Given FA1 that accepts regular expression r1 and FA2 that accepts regular expression r2 then make FA3 that accepts r1 | r2. Add a new start state s and make a ε-transition from this state to the start states of FA1 and FA2. Add a new final state f and make a ε-transition to this state from each of the final states of FA1 and FA2.

Rule 3: Given FA1 that accepts regular expression r1 and FA2 that accepts regular expression r2 then make FA3 that accepts r1·r2.

  • Add a ε-transition from the final state of r1 to the start state of r2.
  • The start state of FA3 is the start state of FA1 and the final state of FA3 is the final state of FA2.

Rule 4: Given FA1 that accepts regular expression r then make an FA2 that accepts r*.

  • Add a new start state s and make a ε-transition from this state to the start state of FA1.
  • Make a ε-transition from the final state of F1 to the new start state s.
  • The final states of FA1 are no longer final and s is the final state of FA2.

nfa's People

Contributors

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