7 ms·
Actually, I very much wanted to do that, the problem is that there seems to be no Scheme implementation available that offers such a tight and convenient libffi
by lritter303 12y ago
Actually, I very much wanted to do that, the problem is that there seems to be no Scheme implementation available that offers such a tight and convenient libffi integration. LuaJIT parses preprocessed C header files with very few adjustments. Terra, which links LuaJIT with LLVM, goes the full mile and directly uses libclang to generate interfaces.
If you know a Scheme implementation that does this (including supporting a LLVM back-end in addition to a regular, possibly JIT'ed interpreter), please do not hesitate to mention!
- Arcanum-XIII 12y agoGambit and Chicken are near your goal, but I don't know how far you can go with it. And there's of course GNU Guile.
- lritter303 12y agoNeither is suitable. Guile has the wrong license, none of these three has bindings for a no-JIT code generator like LLVM. It's no big deal though. The Scheme -> Lua compiler is small (300 lines) the dialect is better suited for hash tables and the dynamic part is mostly a driver to generate/execute machine code at runtime. At this point, a switch to Scheme would service purism more than pragmatism. Lua is already a good Scheme VM (has been strongly inspired by Scheme, in fact) so it'll do. At least I hope it will. ;-)