Just curious... I read somewhere that scheme can compile to a binary. Wondering if there was a way to covert arc code to scheme to accomplish the same thing - or is this against arc ideology ?
MzScheme has mzc, which does bytecode compilation. You can create something like standalone executables by embedding a copy of MzScheme into the module you're compiling. See http://download.plt-scheme.org/doc/372/html/mzc/ for more details.
(module test.arc "arc-exe-init.scm"
(require "ac.scm")
(namespace-require "ac.scm")
(require "brackets.scm")
(use-bracket-readtable)
(aload "arc.arc")
(aload "libs.arc")
(aload "test.arc") ; or the output of (acompile "test.arc") could work
)
Then
$ mzc --exe test test.arc.scm
mzc version 360, Copyright (c) 2004-2006 PLT Scheme Inc.
[output to "test"]
$ ./test
Hello, world
The results you get hardly seem worth the effort. With this, you'd still need to distribute with some form of ac.scm et al.
$ mv test ~/Desktop/
$ cd ~/Desktop/
$ ./test
default-load-handler: cannot open input file: "~/Desktop/ac.scm" (No such file or directory; errno=2)
=== context ===
#f::352: loop
There are probably smarter ways of compiling that don't have this hang-up, but in the end you'll still have kind of a large binary with MzScheme embedded.
If you just want the Scheme equivalent of Arc code, Arc already compiles down to Scheme. To get this compiled version (even if you can't run it directly without loading ac.scm, brackets.scm, arc.arc, and libs.arc):
$ cat test.arc
(prn "Hello, world")
$ mzscheme -m -f as.scm
Use (quit) to quit, (tl) to return here after an interrupt.
arc> :a
> (acompile "test.arc")
Hello, world
#t
> ^D
$ cat test.arc.scm
(ar-funcall1 _prn "Hello, world")
Not to worried about about mzscheme being embedded as it's only 24MB. This is good to know... I plan to experiment with it a little so thanks for guidance.