convert regex into ast, originally written for [](https://github.com/rickbhardwaj/regex-language)