From 6b3cbe2e83b2a3278d83945a529552533b39be88 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Sun, 4 Oct 2015 15:18:23 -0400 Subject: parse functions in minic --- minic/minic.y | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'minic') diff --git a/minic/minic.y b/minic/minic.y index c97a4ca..bb9b1d7 100644 --- a/minic/minic.y +++ b/minic/minic.y @@ -466,17 +466,19 @@ mkstmt(int t, void *p1, void *p2, void *p3) %% -prog: init '{' dcls stmts '}' +prog: prot '{' dcls stmts '}' { stmt($4); fprintf(of, "\tret\n"); + fprintf(of, "}\n\n"); }; -init: +prot: IDENT '(' ')' { varclr(); lbl = 0; tmp = 0; + fprintf(of, "function %s() {\n", $1->u.v); fprintf(of, "@l%d\n", lbl++); }; -- cgit 1.4.1