diff options
| -rw-r--r-- | language/l2_parse.ott | 14 | ||||
| -rw-r--r-- | src/parse_ast.ml | 12 | ||||
| -rw-r--r-- | src/parser.mly | 1 |
3 files changed, 13 insertions, 14 deletions
diff --git a/language/l2_parse.ott b/language/l2_parse.ott index 4112701d..7def314e 100644 --- a/language/l2_parse.ott +++ b/language/l2_parse.ott @@ -360,20 +360,20 @@ typ_lib :: 'Typ_lib_' ::= | nat :: :: nat {{ com natural numbers 0,1,2,... }} | string :: :: string {{ com UTF8 strings }} % finite subranges of nat - | enum nexp1 nexp2 order :: :: enum {{ com natural numbers [[nexp2]] .. [[nexp2]]+[[nexp1]]-1, ordered by order }} + | enum nexp1 nexp2 order :: :: enum {{ com natural numbers [[atyp2]] .. [[atyp2]]+[[atyp1]]-1, ordered by order }} | [ nexp ] :: :: enum1 {{ com sugar for \texttt{enum nexp 0 inc} }} | [ nexp '..' nexp' ] :: :: enum2 {{ com sugar for \texttt{enum (nexp'-nexp+1) nexp inc} or \texttt{enum (nexp-nexp'+1) nexp' dec} }} % use .. not - to avoid ambiguity with nexp - % total maps and vectors indexed by finite subranges of nat - | vector nexp1 nexp2 order typ :: :: vector {{ com vector of [[typ]], indexed by natural range }} + | vector nexp1 nexp2 order atyp :: :: vector {{ com vector of [[atyp]], indexed by natural range }} % probably some sugar for vector types, using [ ] similarly to enums: % (but with .. not : in the former, to avoid confusion...) - | atyp [ nexp ] :: :: vector2 {{ com sugar for vector indexed by [ [[nexp]] ] }} - | atyp [ nexp : nexp' ] :: :: vector3 {{ com sugar for vector indexed by [ [[nexp]]..[[nexp']] ] }} + | atyp [ nexp ] :: :: vector2 {{ com sugar for vector indexed by [ [[atyp]] ] }} + | atyp [ nexp : nexp' ] :: :: vector3 {{ com sugar for vector indexed by [ [[atyp]]..[[atyp']] ] }} % ...so bit [ nexp ] etc is just an instance of that - | list atyp :: :: list {{ com list of [[typ]] }} - | set atyp :: :: set {{ com finite set of [[typ]] }} - | reg atyp :: :: reg {{ com mutable register components holding [[typ]] }} + | list atyp :: :: list {{ com list of [[atyp]] }} + | set atyp :: :: set {{ com finite set of [[atyp]] }} + | reg atyp :: :: reg {{ com mutable register components holding [[atyp]] }} % "reg t" is basically the ML "t ref" % not sure how first-class it should be, though % use "reg word32" etc for the types of vanilla registers diff --git a/src/parse_ast.ml b/src/parse_ast.ml index da716969..948b8ab8 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -411,12 +411,12 @@ type | Typ_lib_enum of terminal * terminal * terminal * terminal (* natural numbers _ .. _+_-1, ordered by order *) | Typ_lib_enum1 of terminal * terminal * terminal (* sugar for \texttt{enum nexp 0 inc} *) | Typ_lib_enum2 of terminal * terminal * terminal * terminal * terminal (* sugar for \texttt{enum (nexp'-nexp+1) nexp inc} or \texttt{enum (nexp-nexp'+1) nexp' dec} *) - | Typ_lib_vector of terminal * terminal * terminal * terminal * terminal (* vector of _, indexed by natural range *) - | Typ_lib_vector2 of atyp * terminal * terminal * terminal (* sugar for vector indexed by [ _ ] *) - | Typ_lib_vector3 of atyp * terminal * terminal * terminal * terminal * terminal (* sugar for vector indexed by [ _.._ ] *) - | Typ_lib_list of terminal * atyp (* list of _ *) - | Typ_lib_set of terminal * atyp (* finite set of _ *) - | Typ_lib_reg of terminal * atyp (* mutable register components holding _ *) + | Typ_lib_vector of terminal * terminal * terminal * terminal * atyp (* vector of atyp, indexed by natural range *) + | Typ_lib_vector2 of atyp * terminal * terminal * terminal (* sugar for vector indexed by [ atyp ] *) + | Typ_lib_vector3 of atyp * terminal * terminal * terminal * terminal * terminal (* sugar for vector indexed by [ atyp.._ ] *) + | Typ_lib_list of terminal * atyp (* list of atyp *) + | Typ_lib_set of terminal * atyp (* finite set of atyp *) + | Typ_lib_reg of terminal * atyp (* mutable register components holding atyp *) type diff --git a/src/parser.mly b/src/parser.mly index 823792d6..d2669ea0 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -603,7 +603,6 @@ fun_def: { } | Function_ Rec atomic_typ funcl_ands { $1,$2,$3,$4 } - /* The below causes 2 shift/reduce conflicts because it can't here tell the difference between the start of the function the potential start of a type */ | Function_ Rec funcl_ands { $1,$2,$3 } | Function_ typquant atomic_typ effect_typ funcl_ands |
