This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bindings


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]