regexen_nfae/regex_to_regex.py

16 lines
316 B
Python
Raw Normal View History

2019-06-01 17:26:40 +00:00
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()