X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=tiger%2Fsrc%2Flib%2Ftiger%2Ftiger_parser.mly;fp=tiger%2Fsrc%2Flib%2Ftiger%2Ftiger_parser.mly;h=27e051d3d1adebfd5333af2e4537a3a4ce181f9c;hb=b9397ef56c9d24d6a974e93dc4a0eb51872ce90c;hp=4497ce30eb51bcb491467fe78e97ba796b2623bc;hpb=29de275c04959d47f3a8b03443e7d9b48853daeb;p=tiger.ml.git diff --git a/tiger/src/lib/tiger/tiger_parser.mly b/tiger/src/lib/tiger/tiger_parser.mly index 4497ce3..27e051d 100644 --- a/tiger/src/lib/tiger/tiger_parser.mly +++ b/tiger/src/lib/tiger/tiger_parser.mly @@ -109,7 +109,7 @@ exp: { sprintf "string[%S]" $1 } - | ID unit + | ID LPAREN RPAREN { let id = $1 in sprintf "fun_call[%s, []]" id @@ -161,9 +161,10 @@ exp: let seq = $4 in sprintf "let[decs[%s], in[seq[%s]]]" decs seq } - | unit + | LPAREN RPAREN { - $1 + (* Perhaps "void"? *) + "unit[]" } seq: @@ -192,18 +193,18 @@ dec: | fundec {$1} fundec: - | FUNCTION ID unit EQ exp + | FUNCTION ID LPAREN RPAREN EQ exp { let id = $2 in - let exp = $5 in - sprintf "fundec[%s, exp[%s]]" id exp + let exp = $6 in + sprintf "fundec[%s, arguments[], exp[%s]]" id exp } | FUNCTION ID LPAREN tyfields RPAREN EQ exp { let id = $2 in let tyfields = $4 in let exp = $7 in - sprintf "fundec[%s, tyfields[%s], exp[%s]]" id tyfields exp + sprintf "fundec[%s, arguments[%s], exp[%s]]" id tyfields exp } | FUNCTION ID LPAREN tyfields RPAREN COLON ID EQ exp { @@ -279,13 +280,6 @@ tyfield: sprintf "tyfield[%s, %s]" id type_id } -/* Perhaps "void"? */ -unit: - | LPAREN RPAREN - { - "unit[]" - } - rec_field_assignments: | ID EQ exp {