3 ms·
Guile compiles to bytecode, is there a way to then link that to guile to create a standalone executable?
by Touche 11y ago
Guile compiles to bytecode, is there a way to then link that to guile to create a standalone executable?
- dorfsmay 11y agoNot that I know of, but Racket and Chicken, and I believe newer versions of Gambit, can produce executable from their version of scheme. Scheme was originally meant to be embedded so compiling to an standalone executable was never part of its goals. http://racket-lang.org/ http://racket-lang.org/ http://www.call-cc.org/ http://www.call-cc.org/ http://gambitscheme.org/wiki/index.php/Main_Page http://gambitscheme.org/wiki/index.php/Main_Page
- 59nadir 11y agoThere's also Stalin, an extremely optimization-heavy compiler for Scheme to C; https://engineering.purdue.edu/~qobi/software.html https://engineering.purdue.edu/~qobi/software.html The 'website' is really just Jeff Siskind's page with a listing of what he's done. It seems mostly dead nowadays and there's very little info to find on it. The following page is pretty much the most amount of actual information I could find: http://community.schemewiki.org/?Stalin http://community.schemewiki.org/?Stalin
- ThatGeoGuy 11y agoKeep in mind that Stalin is a very small subset of R4RS (note that the current is R7RS-small), and in many ways becomes a very small portion of an already small language. This makes it easy to optimize, but can be annoying if you're coming from other languages that are less spartan. As for using Stalin, I would argue that nowadays it is better to use the CHICKEN port of Stalin [1], as it is a bit more up-to-date and provides some extensions (such as using '\n' in string literals, something Stalin didn't provide from the outset!!!). In any case, it's nice to see the variety in Scheme implementations, but in the case of Stalin I personally turn my nose up, as CHICKEN is often fast enough on it's own (or can be made to be), without restricting myself to a very tiny set of tools and libraries. That's not to say the work on Stalin hasn't been appreciated, I'm sure Gambit and CHICKEN have taken their fair share of ideas from Stalin as time has gone on. [1] http://wiki.call-cc.org/eggref/4/stalin http://wiki.call-cc.org/eggref/4/stalin
- bcg1 11y agoGuile is designed to be an embedded language, so in theory you could write a small C wrapper to set up the Guile environment and load your scheme program... I'm not sure if libguile can be statically though The VM written in C that runs the bytecode actually relatively small... most of Guile, including the interpreter and the compilers, are written in Guile itself and run on top of the VM. Those components are compiled object files... they use the ELF format but are not actually executables. IIRC code is loaded by memory mapping the files and Guile has its own way of linking them. I supposed that embedding these files into an executable would require a different mechanism of linking which I am not sure exists. Maybe it does, I just haven't dug that far down into it. The compiler and interpreter take forever to compile BTW... it is definitely preferable to just get Guile from your distro if you can.