When a program is edited, an individual change typically affects only a small part of its structure. In this thesis, we present an approach to incremental syntax and semantic analysis of programs written in the educational language Prev, with the aim of reusing as many previously computed results as possible. For syntax analysis, we use an incremental LL(1) parser. We provide a correctness argument for the algorithm and extend it with simple table-driven error recovery to handle incomplete programs. Our semantic analysis is split into name resolution and type checking. Name resolution uses a scope tree, while type checking relies on recorded dependencies to determine which results need to be recomputed after a change. We integrate the resulting pipeline into a language server for Prev and evaluate its performance on programs of different sizes and under different types of changes, demonstrating that incremental analysis can significantly reduce the time required to reanalyze a program.
|