4 ms·
How can this left-recurse? Can you give an example? I thought regular expressions weren't recursive at all.
by qntm 15y ago
How can this left-recurse? Can you give an example? I thought regular expressions weren't recursive at all.
- Bjartr 15y agoThey're not, most 'regex' engines today aren't actually regular.
- psykotic 15y agoThe Kleene star is a fixed-point/recursion operator. Here's an example that causes an infinite loop: (|a)*
- qntm 15y agoThat's not left-recursion.
- psykotic 15y agoI probably shouldn't have used the 'left' adjective. But that expression results in an unproductive recursion (unproductive meaning that no characters are consumed through each cycle) analogous to what happens when you recursive-descent parse a context-free grammar containing left-recursive productions.