Abstract
Previously published algorithms for LR (k) incremental parsing are inefficient, unnecessarily restrictive, and in some cases incorrect. We present a simple algorithm based on parsing LR(k) sentential forms that can incrementally parse an arbitrary number of textual and/or structural modifications in optimal time and with no storage overhead. The central role of balanced sequences in achieving truly incremental behavior from analysis algorithms is described, along with automated methods to support balancing during parse table generation and parsing. Our approach extends the theory of sentential-form parsing to allow for ambiguity in the grammar, exploiting it for notational convenience, to denote sequences, and to construct compact (“abstract”) syntax trees directly. Combined, these techniques make the use of automatically generated incremental parsers in interactive software development environments both practical and effective. In addition, we address information preservation in these environments: Optimal node reuse is defined; previous definitions are shown to be insufficient; and a method for detecting node reuse is provided that is both simpler and faster than existing techniques. A program representation based on self-versioning documents is used to detect changes in the program, generate efficient change reports for subsequent analyses, and allow the parsing transformation itself to be treated as a reversible modification in the edit log.
- AASA, A. 1995. Precedences in specifications and implementations of programming languages. Theor. Comput. Sci. I~P, 1 (May), 3-26. Google ScholarDigital Library
- AGRAWAL, R. AND DETRO, K. D. 1983. An efficient incremental LR parser for grammars with epsilon productions. Acta Inf. 19, 369-376. Google ScholarDigital Library
- AHO, A. V., JOHNSON, S. C., AND ULLMAN~ J. D. 1975. Deterministic parsing of ambiguous grammars. Commun. ACM 18, 8 (Aug.), 441-452. Google ScholarDigital Library
- AHO, A. V., SETHI, R., AND ULLMAN~ Z. D. 1986. Compilers: Principles, Techniques, and Tools. Addison-Wesley, Reading, Mass. Google ScholarDigital Library
- BALLANCE, R. A., BUTCHER, J., AND GRAHAM~ S. L. 1988. Grammatical abstraction and incremental syntax analysis in a language-based editor. In Proceedings of the A CM SIGPLAN '88 Symposium on Compiler Construction. ACM Press, New York, 185-198. Google ScholarDigital Library
- BEETEM, J. F. AND BEETEM, A. F. 1991. Incremental scanning and parsing with Galaxy. IEEE Trans. Softw. Eng. 17, 7 (July), 641-651. Google ScholarDigital Library
- BURKE, M. G. AND FISHER, G. A. 1987. A practical method for LR and LL syntactic error diagnosis and recovery. ACM Trans. Program. Lang. Syst. 9, 2 (Apr.), 164-197. Google ScholarDigital Library
- CORBETT, Ro 1992. bison release 1.24. Free Software Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139.Google Scholar
- DEGANO~ P., MANNUCCI, S., AND MOJANA, B. 1988. Efficient incremental LR parsing for syntaxdirected editors. ACM Trans. Program. Lang. Syst. 10, 3 (July), 345-373. Google ScholarDigital Library
- GAFTER, N. M. 1990. Parallel incremental compilation. Ph.D. thesis, University of Rochester, Rochester, N.Y. Google ScholarDigital Library
- GHEZZI, C. AND MANDRIOLI, D. 1980. Augmenting parsers to support incrementality. J. A CM PT, 3 (July), 564-579. Google ScholarDigital Library
- HEDIN, G. 1992. Incremental semantic analysis. Ph.D. thesis, Department of Computer Science, Lund University~Google Scholar
- HEERING~ J., HENDRIKS, P. R. H.~ KLINT, P., AND REKERS, J. 1992. The syntax definition formalism SDF Reference Manual. ASF+SDF Project.Google Scholar
- HEILBRUNNER, S. 1979. On the definition of ELR(k) and ELL(k)grammars. Acta Inf. 1i, 169-176.Google Scholar
- JALIL}(, F~ AND GALLIER, J. S. 1982. Building friendly parsers. In Proceedings of the 9th A CM Symposium on the Principles of Programming Languages. ACM Press, New York, 196-206. Google ScholarDigital Library
- KLINT, P. AND VISSER, E. 1994. Using filters for the disaznbiguation of context-free grammars. In Proceedings of the ASMICS Workshop on Parsing Theory.Google Scholar
- LALONDE, W. R. 1977. Regular right part grammars and their parsers. Commun. ACM 20, 10, 731-740. Google ScholarDigital Library
- LARCHEVEQUE, J. M. 1995. Optimal incremental parsing. A CM Trans. Program. Lang. Syst. 17, 1, 1-15. Google ScholarDigital Library
- LI, W. X. 1995a. A simple and efficient incremental LL(1) parsing. In SOFSEM '95: Theory and Practice of Informatics (MiIovy, Czech Republic). Lecture Notes in Computer Science. Springer-Verlag, Berlin, 399-404. Google ScholarDigital Library
- LI, Wo X. 1995b. Towards generating practical language-based editing systems. Ph.D. thesis, University of Western Australia.Google Scholar
- MADDOX, W. 1997. Incremental static semantic analysis. Ph.D. thesis, University of California, Berkeley. Tech. Rep. UCB/CSD-97-948. Google ScholarDigital Library
- MAVERICK, V. 1997. Presentation by tree transformation. Ph.D. thesis, University of California, Berkeley. Tech. Rep UCB/CSD-97-947. Google ScholarDigital Library
- MURCHING, A. M., PRASAD, Y. V., AND SRIKANT, V. N. 1990. Incremental recursive descent parsing. Comput. Lang. 15, 4, 193-204. Google ScholarDigital Library
- PETRONE, L. 1995. Reusing batch parsers as incremental parsers. In Proceeding of the 15th Conference on Foundations of Software Technology and Theoretical Computer Science (Bangalore, India). Lecture Notes in Computer Science, vol. 1026. Springer-Verlag, Berlin, 111-123. Google ScholarDigital Library
- REPS, W. W. AND TEITELBAUM, W. 1989. The Synthesizer Generator: A System for Constructing Language-Based Editors. Springer-Verlag, Berlin. Google ScholarDigital Library
- SASSA, M. AND NAKATA, I. 1987. A simple realization of LR-parsers for regular right part grammars. Inf. Proc. Lett. 24, 113-120. Google ScholarDigital Library
- SHILLING, J. J. 1992. Incremental LL(1) parsing in language-based editors. IEEE Trans. Softw. Eng. 19, 9 (Sept.), 935-940. Google ScholarDigital Library
- TARJAN~ R. E. 1983. Data Structures and Network Algorithms. Society for Industrial and Applied Mathematics, Philadelphia, Pa. Google ScholarDigital Library
- THORUP, M. 1994. Controlled grammatic ambiguity. A CM Trans. Program. Lang. Syst. 16, 3 (May), 1024-1050. Google ScholarDigital Library
- VAN DE VANTER, M. L., GRAHAM, S. L., AND BALLANCE, R. A. 1992. Coherent user interfaces for language-based editing systems. Int. J. Man-Machine Stud. 37, 431-466. Google ScholarDigital Library
- VlSSER, E. 1995. A case study in optimizing parsing schemata by disambiguation filters. Tech. Rep. P9507, Programming Research Group, University of Amsterdam. July.Google Scholar
- WAGNER, T. A. 1997. Practical algorithms for incremental software development environments. Ph.D. thesis, University of California, Berkeley. Tech. Rep. UCB/CSD-97-946. Google ScholarDigital Library
- WAGNER, T. A. AND GRAHAM, S. L. 1997. Efficient self-versioning documents. In CompCon '97. IEEE Computer Society Press, Los Alamitos, Calif., 62-67. Google ScholarDigital Library
- WEGMAN, M. N. 1980. Parsing for structural editors. In Proceeding of the 21st Annual IEEE Symposium on Foundations of Computer Science. IEEE Press, New York, 320-327.Google ScholarDigital Library
- YANG~ W. 1994. Incremental LR parsing. In 1994 International Computer Symposium Conference Proceedings vol. 1. National Chiao Tung University, Hsinchu, Taiwan, 577-583.Google Scholar
- YEH, D. AND KASTENS, U. 1988. Automatic construction of incremental LR(1) parsers. ACM SIGPLAN Not. 23, 3 (Mar.), 33-42. Google ScholarDigital Library
Index Terms
- Efficient and flexible incremental parsing
Recommendations
Fast incremental PEG parsing
SLE 2021: Proceedings of the 14th ACM SIGPLAN International Conference on Software Language EngineeringIncremental 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 (...
Incremental packrat parsing
SLE 2017: Proceedings of the 10th ACM SIGPLAN International Conference on Software Language EngineeringPackrat parsing is a popular technique for implementing top-down, unlimited-lookahead parsers that operate in guaranteed linear time. In this paper, we describe a method for turning a standard packrat parser into an incremental parser through a simple ...
Ambiguity resolution analysis in incremental parsing of natural language
Incremental parsing gains its importance in natural language processing and psycholinguistics because of its cognitive plausibility. Modeling the associated cognitive data structures, and their dynamics, can lead to a better understanding of the human ...
Comments