Packrat parsing is a type of recursive decent parsing with guaranteed liner time parsing. For this,memoization technique is implemented in which all parsing results are memorized to avoid repetitive scanningof inputs in case of backtracking. The issue with this technique is large heap consumption for memoization whichout weigh the benefits. In many situations the developers need to make a tough decision of not implementingpackrat parsing despite the possibility of exponential time parsing. In this paper we present our developedtechnique to avoid such a tough choice. The heap consumption is upper bounded since memorized results arestored in buffer, capacity of which is decided at runtime depending on memory available in the machine. Thisdynamic buffer allocation is implemented by us in Mouse parser. This implementation achieves stableperformance against a variety of inputs with backtracking activities while utilizing appropriate size of memoryfor heap.
Read full abstract