PEG parsing in less space using progressive tabling and dynamic analysis

Fritz Henglein, Ulrik Terp Rasmussen

4 Citationer (Scopus)

Abstract

Tabular top-down parsing and its lazy variant, Packrat, are lineartime execution models for the TDPL family of recursive descent parsers with limited backtracking. Exponential work due to backtracking is avoided by tabulating the result of each (nonterminal, offset)-pair at the expense of always using space proportional to the product of the input length and grammar size. Current methods for limiting the space usage rely either on manual annotations or on static analyses that are sensitive to the syntactic structure of the grammar. We present progressive tabular parsing (PTP), a new execution model which progressively computes parse tables for longer prefixes of the input and simultaneously generates a leftmost expansion of the parts of the parse tree that can be resolved. Table columns can be discarded on-the-fly as the expansion progresses through the input string, providing best-case constant and worst-case linear memory use. Furthermore, semantic actions are scheduled before the parser has seen the end of the input. The scheduling is conservative in the sense that no action has to be "undone" in the case of backtracking. The time complexity is O(dmn) where m is the size of the parser specification, n is the size of the input string, and d is either a configured constant or the maximum parser stack depth. For common data exchange formats such as JSON, we demonstrate practically constant space usage.

OriginalsprogEngelsk
TitelProceedings of the 2017 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation
Antal sider12
ForlagAssociation for Computing Machinery
Publikationsdato2 jan. 2017
Sider35-46
ISBN (Elektronisk)978-1-4503-4721-1
DOI
StatusUdgivet - 2 jan. 2017
Begivenhed2017 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation - Paris, Frankrig
Varighed: 6 jan. 20177 jan. 2017

Konference

Konference2017 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation
Land/OmrådeFrankrig
ByParis
Periode06/01/201707/01/2017

Fingeraftryk

Dyk ned i forskningsemnerne om 'PEG parsing in less space using progressive tabling and dynamic analysis'. Sammen danner de et unikt fingeraftryk.

Citationsformater