Scheme To C Compiler

Discussion of Scheme and Racket

Scheme To C Compiler

Postby BlueHotDog » Thu Oct 29, 2009 12:24 pm

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

Postby findinglisp » Thu Oct 29, 2009 12:48 pm

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.
Posts: 440
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX

Re: Scheme To C Compiler

Postby tkbits » Sat Oct 31, 2009 9:22 am

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.
Posts: 3
Joined: Sat Aug 02, 2008 8:15 pm
Location: USA

Return to Scheme

Who is online

Users browsing this forum: No registered users and 1 guest