cabin-language / cabin

A dead simple, highly performant, extremely safe programming language.
GNU Lesser General Public License v3.0
7 stars 1 forks source link

Remove `Regex` dependency and usage #1

Open vi013t opened 6 months ago

vi013t commented 6 months ago

Currently the Cabin compiler uses regular expressions in a variety of places. This was a decision based on ease-of-use, and not one that has been planned to be permanent. For small simple problems, regular expressions are often overkill and not performant compared to other solutions. For large complex problems, regular expressions are often a complex and non-modular solution and are generally not the best solution for complex grammars. Overall, regular expressions have a small niche of use cases, and the Cabin compiler uses them in a multitude of places (mostly the lexer) for very simple pattern matching.

Because of this, we'd like to remove all uses of regular expressions, as well as the crate dependency, from the crate as a whole. Cabin is currently in pre-alpha as of the time of writing this issue, so most issues aren't being documented (because I am actively fixing several bugs per day, documenting them all would be more trouble than it's worth) but this is a particular enhancement that I'm going to put off until the compiler is in a more stable and complete state. This is mostly because while the regex solution is not the most performant; It is currently a simple solution that's working, and there are lots of other bugs and core features that need to be tackled before handling a performance issue like this.

With that being said, this issue will live here to track and keep in mind that at some point this should get done.