Remove stand-alone tyfield grammar rule
authorSiraaj Khandkar <siraaj@khandkar.net>
Mon, 28 May 2018 18:32:01 +0000 (14:32 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Mon, 28 May 2018 18:32:01 +0000 (14:32 -0400)
tiger/src/lib/tiger/tiger_parser.mly

index a415ae7..43ec10f 100644 (file)
@@ -254,22 +254,19 @@ dec:
     }
 
 tyfields:
-/*| epsilon */
-  | tyfield
-    {$1}
-  | tyfield COMMA tyfields
+  | ID COLON ID
     {
-      let tyfield = $1 in
-      let tyfields = $3 in
-      sprintf "%s, %s" tyfield tyfields
+      let id_1 = $1 in
+      let id_2 = $3 in
+      sprintf "%s : %s" id_1 id_2
     }
-
-tyfield:
-  | ID COLON ID
+  | ID COLON ID COMMA tyfields
     {
-      let id = $1 in
-      let type_id = $3 in
-      sprintf "tyfield[%s, %s]" id type_id
+      let id_1 = $1 in
+      let id_2 = $3 in
+      let tyfield = sprintf "%s : %s" id_1 id_2 in
+      let tyfields = $5 in
+      sprintf "%s, %s" tyfield tyfields
     }
 
 rec_field_assignments:
This page took 0.021618 seconds and 4 git commands to generate.