strongly connected components
[ccc.git] / parse.y
diff --git a/parse.y b/parse.y
index 8a8dca7..29fa0ca 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -29,7 +29,7 @@ int yywrap()
        struct stmt *stmt;
        struct list *list;
        struct vardecl *vardecl;
-       struct decl *decl;
+       struct fundecl *fundecl;
        struct type *type;
        char *ident;
 }
@@ -52,12 +52,12 @@ int yywrap()
 %right POWER
 
 %type <ast> start
-%type <decl> fundecl
 %type <expr> expr
 %type <list> args body decls fargs field fnargs nargs funtype bbody
 %type <stmt> stmt
 %type <type> type ftype
 %type <vardecl> vardecl
+%type <fundecl> fundecl
 
 %%
 
@@ -65,7 +65,7 @@ start : decls { *result = ast($1); } ;
 decls
        : /* empty */ { $$ = NULL; }
        | decls vardecl { $$ = list_cons(decl_var($2), $1); }
-       | decls fundecl { $$ = list_cons($2, $1); }
+       | decls fundecl { $$ = list_cons(decl_fun($2), $1); }
        ;
 vardecl
        : VAR IDENT ASSIGN expr SEMICOLON { $$ = vardecl(NULL, $2, $4); }
@@ -73,9 +73,9 @@ vardecl
        ;
 fundecl
        : IDENT BOPEN args BCLOSE COPEN body CCLOSE
-               { $$ = decl_fun($1, $3, NULL, NULL, $6); }
+               { $$ = fundecl($1, $3, NULL, NULL, $6); }
        | IDENT BOPEN args BCLOSE CONS CONS funtype ARROW ftype COPEN body CCLOSE
-               { $$ = decl_fun($1, $3, $7, $9, $11); }
+               { $$ = fundecl($1, $3, $7, $9, $11); }
        ;
 funtype
        : /* empty */ { $$ = NULL; }