Traditional type-checking programs are typically designed for specific programming languages, re- sulting in complex and tightly coupled imperative implementations. One of the challenges faced by type checkers is ensuring consistent name-binding resolution in the presence of new
...
Traditional type-checking programs are typically designed for specific programming languages, re- sulting in complex and tightly coupled imperative implementations. One of the challenges faced by type checkers is ensuring consistent name-binding resolution in the presence of new names and sym- bols added to the environment. To address this issue, Statix, a domain-specific meta-language for specifying static semantics us- ing scope graphs and constraints aims to reduce the gap between the language specification and the implementation of the type checker. Statix rules define the static semantics of language constructs by employing constraints over type terms and con- straints that define and query a scope graph. To demonstrate this concept, Ministatix, an implemen- tation of the Statix core, is utilized to create a sound type checker for a subset of Java. Ministatix re- solves name bindings in an interleaved manner as the scope graph is constructed. This paper examines an alternative method of us- ing scope graphs for type checking, which involves type checking in separate phases in order to ensure stable queries in the scope graph. Thus avoiding complexities associated with name-binding resolu- tion in Ministatix. We provide an explanation of the required phases and compare the phased type checker to Ministatix in terms of supported Java features, testing, code declarativity and readability, and feature extendability