Today I Learned
Search…
Creating a Regex Compiler/Parser - Research
Making a regex parser/compiler is not simple as it sounds, here is the overview of the steps:
  1. 1.
    Convert the expression to Postfix notation.
    While converting to postfix, you also need to handle Character Classes & Range Quantifiers. Tutorials on internet haven't done this. Read this for an insight on how to do this.
  2. 2.
    Convert the postfix in above step to AST.
  3. 3.
    Convert the AST to a state machine, preferably a NFA (non-deterministic finite automata)

Resources

Copy link
Edit on GitHub