Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

self hosting

Name: Anonymous 2010-10-26 2:47

hey /prog/ how does one make a language self-hosting?

for example, what would it take to make clojure compile directly into an x86 binary

Name: Anonymous 2010-10-26 3:14

It would take some google searches, I suppose

Name: Anonymous 2010-10-26 3:38

Compiler theory, digital logic theory.

Name: Anonymous 2010-10-26 4:13

>>1
read the dragon book

First of all, compilers may be self hosting or not self hosting, but this is not a property that describes languages.  "Self hosting language" doesn't make sense.  "Clojure is self hosting" means that the Clojure compiler (not the language) is written in the Clojure language and that it can compile itself, NOT that it produces x86 binaries.

So your question should be, "How does one write an x86 back-end for a compiler?"  That is a completely different question from the one you asked.  The answer is, "Same way you write any other back end.  The x86 architecture is not special."  However, writing new back ends for x86 is not a productive pastime.  Use an IL like LLVM or C, unless you are an expert or are okay with producing slow binaries.

Name: Anonymous 2010-10-26 4:32

>>4
And why can't he have a self-hosting compiler with a MIPS back-end, you chauvinist

Name: Anonymous 2010-10-26 5:52

>>5
Because the only remaining use of MIPS is by professors who teach how to make compilers, and therefore anyone who would desire a MIPS back end already knows how to write it.

Name: Anonymous 2010-10-26 12:22

>>6-san is oblivious to the existence of the Loongson CPUs.

Name: Anonymous 2010-10-26 12:30

>>7
I don't blame him, they're totally irrelevant.

Name: Anonymous 2010-10-26 17:06

Why bother? The main reason people use Closure is for JVM integration. Otherwise, you might as well just use Common Lisp or Scheme.

Clojure itself has a lot of code written in Java, so that code would have to be rewritten. A simpler way out would be to make a Clojure implementation within a Lisp implementation that already compiles to native code (for example SBCL), however that would mean the implementation is still not written in Clojure, even though it would compile to native code.

Don't change these.
Name: Email:
Entire Thread Thread List