Is Stateful Packrat Parsing Really Linear in Practice? -- A Counter-Example, An Improved Grammar and Its Parsing Algorithms --
Stateful packrat parsing is an algorithm for parsing syntaxes that have context-sensitive features. It is a well-known knowledge among researchers that the running time of stateful packrat parsing is linear for real-world grammars, as demonstrated in existing studies. However, we have found the cases in real-world grammars and tools that lead its running time becomes exponential.
This paper proposes a new grammar, parsing expression grammar with variable bindings, and two parsing algorithms for the grammar, stateful packrat parsing with selected global states and stateful packrat parsing with conditional memoization. Our proposal overcomes the exponential behavior that appears in parsers and guarantees polynomial running time. The key idea behind our algorithms is to memoize the information relevant to the use of the global states in order to avoid memoizing the full global states. We implemented our algorithms as a parser generator and evaluated them on real-world grammars. Our evaluation shows that our algorithms significantly outperform an existing stateful packrat parsing algorithm in terms of both running time and space consumption. In particular, stateful packrat parsing with conditional memoization improves the running time and space consumption for malicious inputs that lead to exponential behavior with the existing algorithm by 260x and 217x, respectively, compared to the existing algorithm.
Sat 22 FebDisplayed time zone: Pacific Time (US & Canada) change
10:30 - 12:00
Session 1 Novel Language Constructs Main Conference
Chair(s): Pavlos Petoumenos University of Manchester
|Bitwidth Customization in Image Processing Pipelines using Interval Analysis and SMT Solvers|
Suresh Purini International Institute of Information Technology Hyderabad, Vinamra Benara UC Berkeley, Ziaul Chowdhury International Institute of Information Technology Hyderabad, Uday Bondhugula Indian Institute of Science
|Is Stateful Packrat Parsing Really Linear in Practice? -- A Counter-Example, An Improved Grammar and Its Parsing Algorithms --|
Nariyoshi Chida NTT Secure Platform Laboratories, Yuhei Kawakoya NTT Secure Platform Laboratories, Dai Ikarashi NTT Secure Platform Laboratories, Kenji Takahashi NTT Security, Koushik Sen University of California, Berkeley
|Automatically Harnessing Sparse Acceleration|
Philip Ginsbach University of Edinburgh, Bruce Collie University of Edinburgh, Michael F. P. O'Boyle University of Edinburgh
|Compiling First-order Functions to Session-Typed Parallel Code|
David Castro-Perez Imperial College London, Nobuko Yoshida Imperial College London