[ANN] clojure-scheme - Compiling Clojure to Scheme to C

Showing 1-10 of 10 messages
[ANN] clojure-scheme - Compiling Clojure to Scheme to C Nathan Sorenson 3/14/12 2:08 PM
I've modified the output of the ClojureScript compiler to emit Scheme code. At this point the core library is successfully compiled by Gambit Scheme. A nice advantage of this is that Gambit compiles code via C, meaning that stand-alone Clojure executables are now available for any platform with a suitable gcc compiler!

Gambit, notably, also compiles to iOS. Just recently I've confirmed that Clojure's core library runs on the iPad simulator.

There is a ton of yak-shaving required at this point---compilation consists of a combination of shell commands, Clojure-interpreted commands and Gambit-interpreted commands. Hopefully this will soon be streamlined.

https://github.com/takeoutweight/clojure-scheme
Re: [ANN] clojure-scheme - Compiling Clojure to Scheme to C David Nolen 3/14/12 2:08 PM
Excellent work!


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] clojure-scheme - Compiling Clojure to Scheme to C Herwig Hochleitner 3/14/12 6:04 PM
That's mighty!
Re: [ANN] clojure-scheme - Compiling Clojure to Scheme to C Chip Collier 3/14/12 3:53 PM
Holy excellent development Batman!

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient
> with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


Re: [ANN] clojure-scheme - Compiling Clojure to Scheme to C Ambrose Bonnaire-Sergeant 3/15/12 7:13 PM
Wow, nice work Nathan!

Ambrose


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: clojure-scheme - Compiling Clojure to Scheme to C Paulo Pinto 3/18/12 5:28 AM
Great work!

Just a question, why Clojure->Scheme->C, instead of Clojure->Clozure?

That way there would no be any C compiler dependency.

--
Paulo
Re: clojure-scheme - Compiling Clojure to Scheme to C Nathan Sorenson 3/21/12 12:46 AM
I see the C code generation as an advantage, in that it becomes possible to target any platform with a C compiler.

Can Clozure compile to iOS?
Re: clojure-scheme - Compiling Clojure to Scheme to C Patrick Logan 3/22/12 2:19 PM
Gambit Scheme especially has a great interface to C/C++/Objective-C. I've been happily using Gambit quite a bit for 20+ years, when it originated as gambit-68k for the Motorola 68000.

Gambit-C's been ported to iOS, Nintendo DS, etc.

In addition to the great C interface, it also has a great Unix/Posix interface, a great threads and message passing library (in the neighborhood of Erlang's performance for numbers of threads and messages per second), etc. It comes with Termite which is an Erlang-like programming model with mobile continuations.

So porting to Gambit provides some good avenues to explore.

-Patrick
Re: clojure-scheme - Compiling Clojure to Scheme to C Devin Walters (devn) 3/26/12 2:19 PM
I've been itching to try this out. I pulled down the repo, grabbed gambit-scheme, and started to look around, but I'm a little lost as to how I can get it working. Could you provide the magic required to make one pass from cljs to scm to c? I would be happy to contribute to the project, but I'm in need of a bit of hand-holding to get started.

Thanks in advance,
'(Devin Walters)

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: clojure-scheme - Compiling Clojure to Scheme to C Nathan Sorenson 3/27/12 11:41 PM
ClojureScript has plenty of sharp edges, and this project is a bit rougher than even ClojureScript at the moment so you'll have to pardon the mess.

The magic happens in the cljs.compiler namespace. Load up a clojure repl and do something along the lines of:

(do (require 'cljs.compiler) (require 'cljs.core) (in-ns 'cljs.compiler) )

after that, you'll be able to compile .cljs files to .scm files via (compile-file "/Users/nathansorenson/src/c-clojure/src/cljs/cljs/core.cljs")

Note how I'm having to be real obvious about the filename right now. You should get an .scm file in the same directory. At that point you can compile it to an .o file with gambit, or just load it in the interpreter to play with

$ gsc
gsc-repl> (load "core.scm" ;interpreted

$ gsc core.scm   ;outputs core.o
gsc-repl> (load "core") ; loads the compiled .o