This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

Scheme To C Compiler

3 posts · 4512 views

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

Since this posting is not user group or conference related, I'm moving it to the Scheme forum. Please categorize your posts appropriately.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/

Re: Scheme To C Compiler

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.