+static void write_expression(const expression_t *expression);
+
+static void write_unary_expression(const unary_expression_t *expression)
+{
+ switch(expression->base.kind) {
+ case EXPR_UNARY_NEGATE:
+ fputc('-', out);
+ break;
+ case EXPR_UNARY_NOT:
+ fputc('!', out);
+ break;
+ default:
+ panic("unimeplemented unary expression found");
+ }
+ write_expression(expression->value);
+}
+
+static void write_expression(const expression_t *expression)
+{
+ const const_expression_t *constant;
+ /* TODO */
+ switch(expression->kind) {
+ case EXPR_CONST:
+ constant = &expression->conste;
+ if(is_type_integer(expression->base.type)) {
+ fprintf(out, "%lld", constant->v.int_value);
+ } else {
+ fprintf(out, "%Lf", constant->v.float_value);
+ }
+ break;
+ EXPR_UNARY_CASES
+ write_unary_expression((const unary_expression_t*) expression);
+ break;
+ default:
+ panic("not implemented expression");
+ }
+}
+
+static void write_enum(const symbol_t *symbol, const enum_type_t *type)
+{
+ fprintf(out, "enum %s:\n", symbol->string);
+
+ declaration_t *entry = type->declaration->next;
+ for ( ; entry != NULL && entry->storage_class == STORAGE_CLASS_ENUM_ENTRY;
+ entry = entry->next) {
+ fprintf(out, "\t%s", entry->symbol->string);
+ if(entry->init.initializer != NULL) {
+ fprintf(out, " <- ");
+ write_expression(entry->init.enum_value);
+ }
+ fputc('\n', out);
+ }
+ fprintf(out, "typealias %s <- int\n", symbol->string);
+ fprintf(out, "\n");
+}
+