start with c codegen
[ccc.git] / ast.c
diff --git a/ast.c b/ast.c
index 29141e4..2bfcf43 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -6,15 +6,15 @@
 #include "ast.h"
 #include "parse.h"
 
-static const char *binop_str[] = {
+const char *binop_str[] = {
        [binor] = "||", [binand] = "&&", [eq] = "==", [neq] = "!=",
        [leq] = "<=", [le] = "<", [geq] = ">=", [ge] = ">", [cons] = ":",
        [plus] = "+", [minus] = "-", [times] = "*", [divide] = "/",
        [modulo] = "%", [power] = "^",
 };
-static const char *fieldspec_str[] = {
+const char *fieldspec_str[] = {
        [fst] = "fst", [snd] = "snd", [hd] = "hd", [tl] = "tl"};
-static const char *unop_str[] = { [inverse] = "!", [negate] = "-", };
+const char *unop_str[] = { [inverse] = "!", [negate] = "-", };
 static const char *basictype_str[] = {
        [btbool] = "Bool", [btchar] = "Char", [btint] = "Int",
        [btvoid] = "Void",
@@ -388,9 +388,8 @@ void stmt_print(struct stmt *stmt, int indent, FILE *out)
                safe_fprintf(out, "while (");
                expr_print(stmt->data.swhile.pred, out);
                safe_fprintf(out, ") {\n");
-               for (int i = 0; i<stmt->data.swhile.nbody; i++) {
+               for (int i = 0; i<stmt->data.swhile.nbody; i++)
                        stmt_print(stmt->data.swhile.body[i], indent+1, out);
-               }
                pindent(indent, out);
                safe_fprintf(out, "}\n");
                break;