jmeaster30 / vore

VerbOse Regular Expressions - Regular Expression Engine with Verbose English-like Syntax
MIT License
1 stars 0 forks source link

Use pattern prefixes to do branch prediction #81

Open jmeaster30 opened 1 year ago

jmeaster30 commented 1 year ago

We could skip a bunch of backtracking if we figure out how to gather prefixes for patterns and have the prefix choose what path to take.

Example: find all letter or digit will always try matching a letter first then when it fails it will backtrack. However, if instead of even checkpointing for it to ultimately fail we can check if we have a digit or a letter and just confidently go down one path or the other.