From comp.lang.scheme [Re: C to Scheme]

Jordan Henderson jordan@Starbase.NeoSoft.COM
Fri, 30 May 1997 22:16:42 -0500 (CDT)

I've been meaning to send this to the list for awhile.

Remember some time back when I suggested that a C->Lisp
translator would be a good way to handle C in the new
LispEnv we've been talking about?

I know that such a thing would be relatively easy.  And
SO WHAT if the code is suboptimal??  The idea is to 
encourage programming in LISP, not C.  C compatibility
is a checklist feature, able to help the guy out who
wants his TeX files, but not the preferred way of doing

Anyway, I'll get off my soapbox and give the following plea
that was posted to comp.lang.scheme recently:

In article <m1sozch9jv.fsf@jupiter.scs.Ryerson.CA> Dave Hanson writes:
>"Me :)" <> writes:
>> Hi peoples.
>> Does anyone have a program (written in scheme) that reads a C file and
>> translates the C code to corresponding scheme code? If you do, could you
>> email it to me at  ????
>I have this as an assignment for my second semester students.  It's
>pretty easy, given that (except for pointer-arithmetic-within-structures)
>C is a Scheme subset.
>I give them a couple functions to manipulate ``pointers'' which are
>pairs containing a vector or string and an offset into that vector or
>I didn't ask them to do structures, but they did handle pointer
>arithmetic on arrays/strings (following strict ANSI C semantics).
>Took me a couple of hours to write.  (Took them ``somewhat'' more. :-)
>   The belief (considered radical by some) that women are people, too."

Looks like poor wratchild has an assignment to do and wants some help...

Dave Hanson seems to indicate that a first pass is trivial, a few hours
work for him.  Admittedly, it's probably not industrial strength and it's
missing at least one necessary C feature.  How difficult would it be to
get full ANSI C?  The run-time libraries would take a little while to get
them good enough to port real world software, but my first guess estimate
is that someone could do a fully reliable, complete ANSI C->Scheme in
6 months in their spare time.

Sounds like an interesting project.  Maybe I'll look at it some more.  I'd
probably choose CL (which would probably make the assignment easier).

-Jordan Henderson