Staged Compilation with Module Functors

被引:0
作者
Chiang, Tsung-ju [1 ]
Yallop, Jeremy [2 ]
Xie, Ningning [1 ]
White, Leo [3 ]
机构
[1] Univ Toronto, Toronto, ON, Canada
[2] Univ Cambridge, Cambridge, England
[3] Jane St Capital, London, England
来源
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL | 2024年 / 8卷 / ICFP期
基金
加拿大自然科学与工程研究理事会;
关键词
Macros; Modules; Compile-time code generation; OCaml; Staging;
D O I
10.1145/3674649
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Multi-stage programming has been used in a wide variety of domains to eliminate the tension between abstraction and performance. However, the interaction of multi-stage programming features with features for programming-in-the-large remains understudied, hindering the full integration of multi-stage programming support into existing languages, and limiting the effective use of staging in large programs. We take steps to remedy the situation by studying the extension of MacoCaml, a recent OCaml extension that supports compile-time code generation via macros and quotations, , with module functors, the key mechanism in OCaml for assembling program components into larger units. We discuss design choices related to evaluation order, formalize our calculus via elaboration, and show that the design enjoys key metatheoretical properties: syntactic type soundness, elaboration soundness, and phase distinction. We believe that this study lays a foundation for the continued exploration and implementation of the OCaml macro system.
引用
收藏
页码:35 / 35
页数:1
相关论文
共 52 条
[1]  
[Anonymous], 2011, P 2011 ACM SIGPLAN W, DOI DOI 10.1145/1929501.1929510
[2]  
APPEL AW, 1994, SIGPLAN NOTICES, V29, P13, DOI 10.1145/773473.178245
[3]  
Calcagno C, 2003, LECT NOTES COMPUT SC, V2830, P57
[4]  
Carette J, 2005, LECT NOTES COMPUT SC, V3676, P256
[5]   Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages [J].
Carette, Jacques ;
Kiselyov, Oleg ;
Shan, Chung-Chieh .
JOURNAL OF FUNCTIONAL PROGRAMMING, 2009, 19 :509-543
[6]   What is a recursive module? [J].
Crary, K ;
Harper, R ;
Puri, S .
ACM SIGPLAN NOTICES, 1999, 34 (05) :50-63
[7]   A temporal-logic approach to binding-time analysis [J].
Davies, R .
11TH ANNUAL IEEE SYMPOSIUM ON LOGIC IN COMPUTER SCIENCE, PROCEEDINGS, 1996, :184-195
[8]  
Davies R., 1996, Conference Record of POPL '96: The 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, P258, DOI 10.1145/237721.237788
[9]  
de Rauglaudre Daniel, 2007, Camlp5 - Reference Manual
[10]  
Dreyer Derek R., 2001, Technical Report CMU-CS-01-112