+ body = indent(generate_function_body(function_declaration.body)),
+ )
+
+PROGRAM_TEMPLATE = string.Template(
+'''
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+struct Object;
+typedef struct Object Object;
+
+enum Type
+{
+ CELL,
+ STRING
+};
+typedef enum Type Type;
+
+struct Cell;
+typedef struct Cell Cell;
+struct Cell
+{
+ Object* left;
+ Object* right;
+};
+
+union Instance
+{
+ Cell cell;
+ char* string;
+};
+typedef union Instance Instance;
+
+Instance makeInstanceFromCell(Cell cell)
+{
+ Instance result;
+ result.cell = cell;
+ return result;
+}
+
+Instance makeInstanceFromString(char* string)
+{
+ Instance result;
+ result.string = string;
+ return result;
+}
+
+struct Object
+{
+ Type type;
+ Instance instance;
+};
+
+Object makeObject(Type t, Instance i)
+{
+ Object result;
+ result.type = t;
+ result.instance = i;
+ return result;
+}
+
+Object makeObjectFromCell(Cell cell)
+{
+ return makeObject(CELL, makeInstanceFromCell(cell));
+}
+
+Object makeObjectFromString(char* string)
+{
+ return makeObject(STRING, makeInstanceFromString(string));
+}
+
+Object* makeObjectPointerFromObject(Object o)
+{
+ Object* result = malloc(sizeof(Object));
+ *result = o;
+ return result;
+}
+
+Object* makeObjectPointerFromCell(Cell cell)
+{
+ return makeObjectPointerFromObject(makeObjectFromCell(cell));
+}
+
+Object* makeObjectPointerFromString(char* string)
+{
+ return makeObjectPointerFromObject(makeObjectFromString(string));
+}
+
+Cell makeCell(Object* left, Object* right)
+{
+ Cell result;
+ result.left = left;
+ result.right = right;
+ return result;
+}
+
+Object* c_cons(Object* left, Object* right)
+{
+ Cell cell = makeCell(left, right);
+ return makeObjectPointerFromCell(cell);
+}
+
+void c_print(Object* stutter_string)
+{
+ assert(stutter_string->type == STRING);
+ char* c_string = stutter_string->instance.string;
+ printf("%s", c_string);
+}
+
+int countArgs(Object* args)
+{
+ if(args == NULL) return 0;
+
+ assert(args->type == CELL);
+ return 1 + countArgs(args->instance.cell.right);
+}
+
+Object* getArg(int index, Object* args)
+{
+ if(index == 0) return args->instance.cell.left;
+
+ return getArg(index - 1, args->instance.cell.right);
+}
+
+void print(Object* args)
+{
+ assert(countArgs(args) == 1);
+ Object* stutter_string = getArg(0, args);
+ c_print(stutter_string);
+}
+
+int main(int argc, char** argv)
+{
+$body
+}
+'''.strip())
+
+def generate_program(body):
+ return PROGRAM_TEMPLATE.substitute(
+ body = body,