summary refs log tree commit diff
path: root/minic/minic.y
diff options
context:
space:
mode:
Diffstat (limited to 'minic/minic.y')
-rw-r--r--minic/minic.y6
1 files changed, 4 insertions, 2 deletions
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++);
 };