Fast Incremental PEG ParsingVirtual
Mon 18 Oct 2021 18:50 - 19:05 at Zurich C - SLE/GPCE Session 6 Chair(s): Ran Wei, Paddy Krishnan
Incremental parsing is an integral part of code analysis performed by text editors and integrated development environments. This paper presents new methods to significantly improve the efficiency of incremental parsing for Parsing Expression Grammars (PEGs). We build on Incremental Packrat Parsing, an algorithm that adapts packrat parsing to an incremental setting, by implementing the memoization table as an interval tree with special support for shifting intervals, and modifying the memoization strategy to create tree structures in the table. Our approach enables reparsing in time logarithmic in the size of the input for typical edits, compared with linear-time reparsing for Incremental Packrat Parsing. We implement our methods in a prototype called GPeg, a parsing machine for PEGs with support for dynamic parsers (an important feature for runtime extensibility in editors). Experiments show that GPeg has strong performance (sub-5ms reparse times) across a variety of input sizes (tens to hundreds of megabytes) and grammar types (from full language grammars to “island” grammars), and compares well with existing incremental parsers. As a complete application example, we also implement a syntax highlighting engine on top of GPeg, and a prototype editor, along with some optimizations for this particular use-case.
Mon 18 OctDisplayed time zone: Central Time (US & Canada) change
10:50 - 12:10 | SLE/GPCE Session 6SLE / GPCE at Zurich C +8h Chair(s): Vadim Zaytsev University of Twente, Netherlands | ||
10:50 15mTalk | Fast Incremental PEG ParsingVirtual SLE | ||
11:05 15mTalk | Faster Reachability Analysis for LR(1) ParsersVirtual SLE | ||
11:20 15mTalk | Automatic Grammar RepairVirtual SLE Moeketsi Raselimo Stellenbosch University, South Africa, Bernd Fischer Stellenbosch University, South Africa | ||
11:35 8mTalk | Vision: Bias in Systematic Grammar-Based Test Suite Construction AlgorithmsVirtual SLE Christoff Rossouw Stellenbosch University, South Africa, Bernd Fischer Stellenbosch University, South Africa | ||
11:43 8mTalk | Compiling pattern matching to in-place modificationsVirtual GPCE | ||
11:51 19mLive Q&A | Discussion, Questions and Answers SLE |
18:50 - 20:10 | SLE/GPCE Session 6GPCE / SLE at Zurich C Chair(s): Ran Wei Dalian University of Technology, Paddy Krishnan Oracle Labs, Australia | ||
18:50 15mTalk | Fast Incremental PEG ParsingVirtual SLE | ||
19:05 15mTalk | Faster Reachability Analysis for LR(1) ParsersVirtual SLE | ||
19:20 15mTalk | Automatic Grammar RepairVirtual SLE Moeketsi Raselimo Stellenbosch University, South Africa, Bernd Fischer Stellenbosch University, South Africa | ||
19:35 8mTalk | Vision: Bias in Systematic Grammar-Based Test Suite Construction AlgorithmsVirtual SLE Christoff Rossouw Stellenbosch University, South Africa, Bernd Fischer Stellenbosch University, South Africa | ||
19:43 8mTalk | Compiling pattern matching to in-place modificationsVirtual GPCE | ||
19:51 19mLive Q&A | Discussion, Questions and Answers SLE |