[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with GCC as a Scheme compiler: tail calls

From: Noah Lavine
Subject: Re: Problem with GCC as a Scheme compiler: tail calls
Date: Mon, 11 Apr 2011 19:12:48 -0400


> Regarding GCC, I have spoken to GCC folk, and they are not averse to
> making GCC into a more modular thing.  There are obvious licensing
> concerns, but these are surmountable: Guile and GCC could work together
> somehow.  The problem, as I understood it last year, was that GCC
> doesn't know exactly what abstractions are necessary.  For that we need
> to get our own house in order, write an AOT compiler for one
> architecture, then go to GCC and say "it would be nice if we had these
> features", or something like that.
> People's experiences with LLVM are probably helping here, to define the
> problem space, but we need something simple to push to GCC folk, like a
> simple less-than-Scheme implementation with only fixnum arithmetic or
> something, both AOT and with a REPL.

Neat! I had an idea of how this transition could go that is different,
but I think might turn out to involve a lot of the same steps as

I was imagining that we would start with a compiler that was almost
all custom code, except that the backend is GCC. In the most extreme
case, maybe GCC would act as a big assembler, but I think we should be
able to use a few more of its features than that. Once we have that, I
imagine that we could integrate our code into GCC over time, either
merging our stuff with existing similar code already in GCC or adding
new things. If I understand correctly, you were thinking that we would
write our compiler with some other backend, figure out what changes we
want GCC to make, then switch to using GCC once they're ready. Right?

I was also imagining that we could start with a batch-compiling AOT
compiler like current GCC, and then make it more dynamic as GCC became
more modular. It seems like you want to start out with something that
could be called in the background by the runtime. Is that right?

I was thinking that if we could teach GCC to compile tail calls, then
we could use quite a bit of its infrastructure without any further
changes, because we could make a Scheme procedure compile to a GCC
procedure, and in fact implement all Scheme control flow stuff as a
bunch of GCC procedures. We would still have to implement Scheme
datatypes ourselves, but that would still give us a decent amount of
integration to begin with. What do you think?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]