Skip to content

input a regular expression, outputs ‘yes’ if w is in L(R), ‘no’ else

Notifications You must be signed in to change notification settings

SonomaPals/NFA-membership-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Regular expression/NFA membership test

Contributors

Usage

main.py

Input

A regular expression R

    The following regular expression conventions are recognized by this program:
    • The only input characters permitted are lowercase letters a-z and numeric digits 0-9
    • Parentheses may be used to manipulate order of operation
    • Epsilon is represented using the symbol E
    • A union is represented by the symbol +
    • The Kleene star is represented by the standard symbol *
    • Concatenation is represented by the symbol .
        Note: implicit concatenation is not permitted, i.e. "aba" should be written as a.b.a

A string w

Task

  1. Convert the regular expression R to an epsilon-NFA M1.
  2. Remove epsilon transitions to obtain epsilon-free NFA M2.
  3. Test if the string w is accepted by the epsilon-free NFA M2.

Output

True/false: Whether or not the string w is the in the language of the regular expression R, i.e. if w is in L(R).

About

input a regular expression, outputs ‘yes’ if w is in L(R), ‘no’ else

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages