Using Standard Typing Algorithms Incrementally
Modern languages are equipped with static type checking/inference that helps programmers to keep a clean programming style and to reduce errors. However, the ever-growing size of programs and their continuous evolution require building fast and efficient analyzers. A promising solution is incrementality, so one only re-types those parts of the program that are new or changed, rather than the entire codebase. We propose an algorithmic schema driving the definition of an incremental typing algorithm that exploits with no changes to the existing, standard ones. Ours is a grey-box approach, meaning that just the shape of the input, that of the results and some domain-specific knowledge are needed to instantiate our schema. Here, we present the foundations of our approach and we show it at work to derive three different incremental typing algorithms. The first two implement type checking and inference for a functional language. The last one type-checks an imperative language to detect information flow and non-interference. A prototypical implementation of an incremental type checker is available on the web.
READ FULL TEXT