This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Bindings
- From: Chris Dean <Chris dot Dean at sokitomi dot com>
- To: "Alexandre Lemaire" <rm1x at rogers dot com>
- Cc: kawa at sources dot redhat dot com
- Date: Sun, 13 Jul 2003 23:02:17 -0700
- Subject: Re: Bindings
- References: <001901c349c0$ae9f9bb0$0700a8c0@Lexx>
I know you're trying to be clear but I can't quite figure out your
question. If you're asking how the Kawa compiler translates Scheme code
to JVM byte codes I can suggest two approaches:
- Read http://www.gnu.org/software/kawa/internals.html
- Compile the Scheme code to a .class file and decompile the code to
Java. For example if we compile this with kawa -C Foo.scm:
(define (addme a b) (+ a b))
(define (caller) (addme 52 0))
And decompile with jode Foo we get this output (edited for clarity):
public class Foo extends ModuleBody {
static final IntNum Lit0;
static final IntNum Lit1 = IntNum.make(0);
static { Lit0 = IntNum.make(52); }
public static Object addme(Object a, Object b) {
return AddOp.$Pl.apply2(a, b);
}
public static Object caller() {
return addme(Lit0, Lit1);
}
// ...
}
As you can see, once the code is compiled there isn't (at least in my
mind) a "Scheme level", everything is in Java bytecodes. There are
helper classes (like AddOp and IntNum) but those are just ordinary Java
classes whose source is available in the Kawa code distribution.
Regards,
Chris Dean