From: Siraaj Khandkar Date: Mon, 28 May 2018 18:32:01 +0000 (-0400) Subject: Remove stand-alone tyfield grammar rule X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=a87678f05df6d8d1dfd1c5ab38666c6f1fe31322;p=tiger.ml.git Remove stand-alone tyfield grammar rule --- diff --git a/tiger/src/lib/tiger/tiger_parser.mly b/tiger/src/lib/tiger/tiger_parser.mly index a415ae7..43ec10f 100644 --- a/tiger/src/lib/tiger/tiger_parser.mly +++ b/tiger/src/lib/tiger/tiger_parser.mly @@ -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: