Page 1 of 1

Scheme To C Compiler

Posted: Thu Oct 29, 2009 12:24 pm
by BlueHotDog
Hi guys,
i have an assignment from collage,
the input is a list, something in the form of
'(a (b c) (d (e f) (g (h i) (j k)))))
and the function should return something like this:
(let ((g16 (b c))
(g14 (e f))
(g12 (h i))
(g11 (j k)))
(let ((g13 (g g12 g11)))
(let ((g15 (d g14 g13)))
(a g16 g15))))

any help would be greatly appreciated..

Re: Scheme To C Compiler

Posted: Thu Oct 29, 2009 12:48 pm
by findinglisp
Since this posting is not user group or conference related, I'm moving it to the Scheme forum. Please categorize your posts appropriately.

Re: Scheme To C Compiler

Posted: Sat Oct 31, 2009 9:22 am
by tkbits
As it's not generating any C code, this is just the first step.

All you need to do is break out the subexpressions, bind their results to new symbols, and restate each subexpression so that it contains exactly one procedure call. It looks like one let is used for the outermost procedure call, and the other lets are used for intermediate procedure calls.