Journal of Information Processing
Online ISSN : 1882-6652
Packrat Parsing with Elastic Sliding Window
Kimio Kuramitsu
Author information
JOURNALS FREE ACCESS

2015 Volume 23 Issue 4 Pages 505-512

Details
Abstract

Packrat parsing is a linear-time implementation method of recursive descent parsers. The trick is a memoization mechanism, where all parsing results are memorized to avoid redundant parsing in cases of backtracking. An arising problem is extremely huge heap consumption in memoization, resulting in the fact that the cost of memoization is likely to outweigh its benefits. In many cases, developers need to make a difficult choice to abandon packrat parsing despite the possible exponential time parsing. Elastic packrat parsing is developed in order to avoid such a difficult choice. The heap consumption is upper-bounded since memorized results are stored on a sliding window buffer. In addition, the buffer capacity is adjusted by tracing each of nonterminal backtracking activities at runtime. Elastic packrat parsing is implemented in a part of our Nez parser. We demonstrate that the elastic packrat parsing achieves stable and robust performance against a variety of inputs with different backtracking activities.

Information related to the author
© 2015 by the Information Processing Society of Japan
Previous article Next article
feedback
Top