Add regex_to_regex.py

This commit is contained in:
Juhani Krekelä 2019-06-01 20:26:40 +03:00
parent 440aedbf64
commit d7bab30809
1 changed files with 15 additions and 0 deletions

15
regex_to_regex.py Normal file
View File

@ -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()