Get the latest tech news

Fixing left and mutual recursions in grammars


Left & Mutual Recursion Mitigation

When parsing or generating a string using this grammar (using a backtracking algorithm), where $ \langle S \rangle $ is the start symbol, you are likely to enter a state of infinite recursion. So, I’ve been (re)writing a C++ demangler for RizinOrg’s rz-libdemangle which was previously licensed to GPL, and I’m re-writing it to relicense it to LGPL v3, which is more permissive for commercial usage. These normalized forms generally do transformations to original grammar to remove redundancy, and help the actual parsing algorithm make correct decisions faster.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of recursions

recursions

Photo of grammars

grammars