Electronic Notes in Theoretical Computer Science · 2001 · 85 citations · 5 references
ComputingComputer ScienceCompilersProgramming LanguagesSyntaxAbstract Syntax TreesCompiler ConstructionData TypesForeign Function InterfacesType CheckingType SystemsAbstractionAbstraction MechanismsC Foreign Function InterfaceCompiler DesignConstructorsLow-level C ProgrammingStruct TypesType Constructors
Data-level interoperability enables ML programs to inspect and manipulate C data structures directly. The authors introduce a new foreign‑function interface for SML/NJ. The interface encodes nearly the entire C type system into ML types using polymorphism, type constructors, abstraction mechanisms, and functors, while a lightweight program‑generator translates C struct and union declarations into ML glue code hidden from the programmer.
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 almost2 complete 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.
5
Cordelia Hall, Kevin Hammond, Simon Jones et al. · ACM Transactions on Programming Languages and Systems · 1996 · 251 citations · Full text
Sigbjørn Finne, Daan Leijen, Erik Meijer et al. · 1998 · 50 citations
M. Blume, Andrew W. Appel · 1997 · 22 citations