Download PDFOpen PDF in browser

Parse Condition: Symbolic Encoding of LL(1) Parsing

19 pagesPublished: October 23, 2018

Abstract

In this work, we propose the notion of a Parse Condition—a logical condition that is satisfiable if and only if a given string w can be successfully parsed using a grammar G. Further, we propose an algorithm for building an SMT encoding of such parse conditions for LL(1) grammars and demonstrate its utility by building two applications over it: automated repair of syntax errors in Tiger programs and automated parser synthesis to automatically synthesize LL(1) parsers from examples. We implement our ideas into a tool, Cyclops, that is able to successfully repair 80% of our benchmarks (675 buggy Tiger programs), clocking an average of 30 seconds per repair and synthesize parsers for interesting languages from examples. Like verification conditions (encoding a program in logic) have found widespread applications in program analysis, we believe that Parse Conditions can serve as a foundation for interesting applications in syntax analysis.

Keyphrases: constraint solving, LL(1) parsing, SMT encoding

In: Gilles Barthe, Geoff Sutcliffe and Margus Veanes (editors). LPAR-22. 22nd International Conference on Logic for Programming, Artificial Intelligence and Reasoning, vol 57, pages 637--655

Links:
BibTeX entry
@inproceedings{LPAR-22:Parse_Condition_Symbolic_Encoding,
  author    = {Dhruv Singal and Palak Agarwal and Saket Jhunjhunwala and Subhajit Roy},
  title     = {Parse Condition: Symbolic Encoding of LL(1) Parsing},
  booktitle = {LPAR-22. 22nd International Conference on Logic for Programming, Artificial Intelligence and Reasoning},
  editor    = {Gilles Barthe and Geoff Sutcliffe and Margus Veanes},
  series    = {EPiC Series in Computing},
  volume    = {57},
  pages     = {637--655},
  year      = {2018},
  publisher = {EasyChair},
  bibsource = {EasyChair, https://easychair.org},
  issn      = {2398-7340},
  url       = {https://easychair.org/publications/paper/DtjZ},
  doi       = {10.29007/2ndp}}
Download PDFOpen PDF in browser