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
中科院分区:
数学3区
文献类型:
--
作者:
Matthias Blume

文献摘要

被引文献

相似文献

我们为 SML/NJ 提供了一个新的外部函数接口。它基于数据级互操作性的理念——机器学习程序直接检查和操作 C 数据结构的能力。这项工作的核心组件是几乎完整的 C 类型系统在 ML 类型中的编码。该编码广泛使用了“民间传说”打字技巧,利用了机器学习的多态性、类型构造函数、抽象机制,甚至函子。处理 C 结构和联合声明以及程序链接的小型低级组件通过一个简单的程序生成器工具隐藏在程序员的视线之外,该工具将 C 声明转换为相应的 ML 粘合代码。
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.