Modular and Automated Type-Soundness Verification for Language Extensions

被引:0
作者
Lorenzen, Florian [1 ]
Erdweg, Sebastian [2 ]
机构
[1] TU Berlin, Berlin, Germany
[2] Tech Univ Darmstadt, Darmstadt, Germany
关键词
Languages; Verification; language extensibility; type soundness; automatic verification; metaprogramming; macros; SugarJ;
D O I
10.1145/2544174.2500596
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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-omega that we extend with let notation, monadic do blocks, and algebraic data types. Our formalism verifies the soundness of each extension automatically.
引用
收藏
页码:331 / 342
页数:12
相关论文
共 31 条
[1]  
Bracha Gilad, 2004, OOPSLA WORKSH REV DY
[2]  
Bravenboer M, 2006, FUND INFORM, V69, P123
[3]   Flexible type analysis [J].
Crary, K ;
Weirich, S .
ACM SIGPLAN NOTICES, 1999, 34 (09) :233-248
[4]  
de Rauglaudre D., 2003, CAMLP4 REF MAN
[5]  
Erdweg S., 2012, P WORKSH LANG DESCR
[6]  
Erdweg S, 2013, THESIS PHILIPPS U MA
[7]   Layout-sensitive Language Extensibility with SugarHaskell [J].
Erdweg, Sebastian ;
Rieger, Felix ;
Rendel, Tillmann ;
Ostermann, Klaus .
ACM SIGPLAN NOTICES, 2012, 47 (12) :149-159
[8]  
Erdweg S, 2011, GPCE 11: PROCEEDINGS OF THE TENTH INTERNATIONAL CONFERENCE ON GENERATIVE PROGRAMMING AND COMPONENT ENGINEERING, P167
[9]   SugarJ: Library-based Syntactic Language Extensibility [J].
Erdweg, Sebastian ;
Rendel, Tillmann ;
Kaestner, Christian ;
Ostermann, Klaus .
ACM SIGPLAN NOTICES, 2011, 46 (10) :391-406
[10]  
Erdweg Sebastian., 2012, PROC C SOFTWARE LANG, V7745 of LNCS, P244, DOI DOI 10.1007/978-3-642-36089-3_14