Add regex_to_regex.py
This commit is contained in:
parent
440aedbf64
commit
d7bab30809
|
@ -0,0 +1,15 @@
|
|||
from regex import lit, concat, bar, star
|
||||
from regex_to_nfa import to_nfa
|
||||
from nfa_to_regex import to_regex
|
||||
|
||||
def main():
|
||||
regex = concat(bar(lit('foo'), lit('bar')), bar(lit('baz'), lit('qux')))
|
||||
print(regex)
|
||||
|
||||
nfa = to_nfa(regex)
|
||||
regex_prime = to_regex(nfa)
|
||||
|
||||
print(regex_prime)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue