Incremental parsing in language‐based editors: user needs and how to meet them

Incremental parsing has long been recognized as a technique of great utility in the construction of language‐based editors, and correspondingly, the area currently enjoys a mature theory. Unfortunately, many practical considerations have been largely overlooked in previously published algorithms. Many user requirements for an editing system necessarily impact on the design of its incremental parser, but most approaches focus only on one: response time. This paper details an incremental parser based on LR parsing techniques and designed for use in a modeless syntax recognition editor. The nature of this editor places significant demands on the structure and quality of the document representation it uses, and hence, on the parser. The strategy presented here is novel in that both the parser and the representation it constructs are tolerant of the inevitable and frequent syntax errors that arise during editing. This is achieved by a method that differs from conventional error repair techniques, and that is more appropriate for use in an interactive context. Furthermore, the parser aims to minimize disturbance to this representation, not only to ensure other system components can operate incrementally, but also to avoid unfortunate consequences for certain user‐oriented services. The algorithm is augmented with a limited form of predictive tree‐building, and a technique is presented for the determination of valid symbols for menu‐based insertion. Copyright © 2001 John Wiley & Sons, Ltd.

[1]  Frank DeRemer,et al.  A forward move algorithm for LR error recovery , 1978, POPL '78.

[2]  Warren X. Li A new approach to incremental LR parsing , 1997, J. Program. Lang..

[3]  Jean H. Gallier,et al.  Building friendly parsers , 1982, POPL '82.

[4]  Luigi Petrone Reusing Batch Parsers as Incremental Parsers , 1995, FSTTCS.

[5]  Jim Welsh,et al.  A design rationale for a language‐based editor , 1991, Softw. Pract. Exp..

[6]  Jean-Marie Larchevêque Optimal incremental parsing , 1995, TOPL.

[7]  Warren X. Li A Simple and Efficient Incremental LL(1) parsing , 1995, SOFSEM.

[8]  David A. Carrington,et al.  Generic description of a software document environment , 2001, Proceedings of the 34th Annual Hawaii International Conference on System Sciences.

[9]  Manuel Vilares Ferro,et al.  Regional Least-Cost Error Repair , 2000, CIAA.

[10]  J. Welsh,et al.  Formatted programming languages , 1981, Softw. Pract. Exp..

[11]  Tim A. Wagner,et al.  Practical algorithms for incremental software development environments , 1998 .

[12]  Gordon Lyon,et al.  Syntax-directed least-errors analysis for context-free languages , 1974, Commun. ACM.

[13]  Carlo Ghezzi,et al.  Incremental Parsing , 1979, TOPL.

[14]  Chris D. Marlin Language-specific Editors for Block-Structured Programming Languages , 1986, Aust. Comput. J..

[15]  Jim Welsh,et al.  Designing a user-interface for relational documents , 1998 .

[16]  Tim A. Wagner,et al.  Efficient and flexible incremental parsing , 1998, TOPL.

[17]  Alfred V. Aho,et al.  A Minimum Distance Error-Correcting Parser for Context-Free Languages , 1972, SIAM J. Comput..

[18]  Susan L. Graham,et al.  Practical syntactic error recovery , 1975, CACM.

[19]  Manuel Vilares Ferro,et al.  Efficient incremental parsing for context-free languages , 1994, Proceedings of 1994 IEEE International Conference on Computer Languages (ICCL'94).

[20]  Sidney L. Smith,et al.  Guidelines for Designing User Interface Software , 1986 .

[21]  Bruce J. McKenzie,et al.  Error repair in shift-reduce parsers , 1995, TOPL.

[22]  Carlo Ghezzi,et al.  Augmenting Parsers to Support Incrementality , 1980, JACM.