English

Default Disambiguation for Online Parsers

Programming Languages 2020-07-03 v3

Abstract

Since composed grammars are often ambiguous, grammar composition requires a mechanism for dealing with ambiguity: either ruling it out by using delimiters (which are awkward to work with), or by using disambiguation operators to filter a parse forest down to a single parse tree (where, in general, we cannot be sure that we have covered all possible parse forests). In this paper, we show that default disambiguation, which is inappropriate for batch parsing, works well for online parsing, where it can be overridden by the user if necessary. We extend language boxes -- a delimiter-based algorithm atop incremental parsing -- in such a way that default disambiguation can automatically insert, remove, or resize, language boxes, leading to the automatic language boxes algorithm. The nature of the problem means that default disambiguation cannot always match a user's intention. However, our experimental evaluation shows that automatic language boxes behave acceptably in 98.8% of tests involving compositions of real-world programming languages.

Keywords

Cite

@article{arxiv.1909.08557,
  title  = {Default Disambiguation for Online Parsers},
  author = {Lukas Diekmann and Laurence Tratt},
  journal= {arXiv preprint arXiv:1909.08557},
  year   = {2020}
}

Comments

14 pages, 6 tables, 8 figures. Note: This reverts this paper back to v1 (which was accidentally replaced with a different paper)

R2 v1 2026-06-23T11:19:24.879Z