No-Longer-Foreign: Teaching an ML compiler to speak C "natively"
No-Longer-Foreign: Teaching an ML compiler to speak C "natively"
复制标题
不再是外来的:教 ML 编译器“原生地”讲 C
DOI:
10.1016/s1571-0661(05)80452-9
复制
发表时间:
2001
影响因子:
0.6
通讯作者:
Matthias Blume
中科院分区:
文献类型:
--
作者:
Matthias Blume
We present a new foreign-function interface for SML/NJ. It is based on the idea of data-level interoperability—the ability of ML programs to inspect as well as manipulate C data structures directly. The core component of this work is an encoding of the almost2complete C type system in ML types. The encoding makes extensive use of a “folklore” typing trick, taking advantage of ML's polymorphism, its type constructors, its abstraction mechanisms, and even functors. A small low-level component which deals with C struct and union declarations as well as program linkage is hidden from the programmer's eye by a simple program-generator tool that translates C declarations to corresponding ML glue code.