Language extensions introduce high-level programming constructs that protect programmers from low-level details and repetitive tasks. For such an abstraction barrier to be sustainable, it is important that no errors are reported in terms of generated code. A typical strategy is to check the original user code prior to translation into a low-level encoding, applying the assumption that the translation does not introduce new errors. Unfortunately, such assumption is untenable in general, but in particular in the context of extensible programming languages, such as Racket or SugarJ, that allow regular programmers to define language extensions. In this paper, we present a formalism for building and automatically verifying the type-soundness of syntactic language extensions. To build a type-sound language extension with our formalism, a developer declares an extended syntax, type rules for the extended syntax, and translation rules into the (possibly further extended) base language. Our formalism then validates that the user-defined type rules are sufficient to guarantee that the code generated by the translation rules cannot contain any type errors. This effectively ensures that an initial type check prior to translation precludes type errors in generated code. We have implemented a core system in PLT Redex and we have developed a syntactically extensible variant of System Fω that we extend with let notation, monadic do blocks, and algebraic data types. Our formalism verifies the soundness of each extension automatically.
| Zugehörige Institution am KIT | Institut für Programmstrukturen und Datenorganisation (IPD) |
|---|---|
| Sprache | englisch |
| KITopen-ID | 1000188544 |
| Schlagwörter | Automatic verification, Language extensibility, Macros, Metaprogramming, SugarJ, Type soundness |
| Verlag | Association for Computing Machinery (ACM) |
| ISBN des Proceedingsbands | 978-1-4503-2326-0 |
| Veranstaltung | 18th ACM SIGPLAN International Conference on Functional Programming, Boston, MA, USA, 25. – 27.09.2013 |
| Nachgewiesen in | Web of Science Scopus Dimensions OpenAlex |
| Globale Ziele für nachhaltige Entwicklung |