summaryrefslogtreecommitdiff
path: root/language/l2_parse.ml
diff options
context:
space:
mode:
Diffstat (limited to 'language/l2_parse.ml')
-rw-r--r--language/l2_parse.ml115
1 files changed, 60 insertions, 55 deletions
diff --git a/language/l2_parse.ml b/language/l2_parse.ml
index 741a8a94..7be33bc4 100644
--- a/language/l2_parse.ml
+++ b/language/l2_parse.ml
@@ -30,6 +30,12 @@ base_kind =
type
+id_aux = (* Identifier *)
+ Id of x
+ | DeIid of x (* remove infix status *)
+
+
+type
kid_aux = (* identifiers with kind, ticked to differntiate from program variables *)
Var of x
@@ -46,14 +52,13 @@ base_effect_aux = (* effect *)
type
-id_aux = (* Identifier *)
- Id of x
- | DeIid of x (* remove infix status *)
+kind_aux = (* kinds *)
+ K_kind of (base_kind) list
type
-kind_aux = (* kinds *)
- K_kind of (base_kind) list
+id =
+ Id_aux of id_aux * l
type
@@ -67,11 +72,6 @@ base_effect =
type
-id =
- Id_aux of id_aux * l
-
-
-type
kind =
K_aux of kind_aux * l
@@ -252,21 +252,15 @@ and letbind =
type
-type_union_aux = (* Type union constructors *)
- Tu_id of id
- | Tu_ty_id of atyp * id
-
-
-type
name_scm_opt_aux = (* Optional variable-naming-scheme specification for variables of defined type *)
Name_sect_none
| Name_sect_some of string
type
-effect_opt_aux = (* Optional effect annotation for functions *)
- Effect_opt_pure (* sugar for empty effect set *)
- | Effect_opt_effect of atyp
+type_union_aux = (* Type union constructors *)
+ Tu_id of id
+ | Tu_ty_id of atyp * id
type
@@ -276,6 +270,12 @@ tannot_opt_aux = (* Optional type annotation for functions *)
type
+effect_opt_aux = (* Optional effect annotation for functions *)
+ Effect_opt_pure (* sugar for empty effect set *)
+ | Effect_opt_effect of atyp
+
+
+type
rec_opt_aux = (* Optional recursive annotation for functions *)
Rec_nonrec (* non-recursive *)
| Rec_rec (* recursive *)
@@ -287,6 +287,11 @@ funcl_aux = (* Function clause *)
type
+name_scm_opt =
+ Name_sect_aux of name_scm_opt_aux * l
+
+
+type
index_range_aux = (* index specification, for bitfields in register types *)
BF_single of int (* single index *)
| BF_range of int * int (* index range *)
@@ -302,8 +307,8 @@ type_union =
type
-name_scm_opt =
- Name_sect_aux of name_scm_opt_aux * l
+tannot_opt =
+ Typ_annot_opt_aux of tannot_opt_aux * l
type
@@ -312,11 +317,6 @@ effect_opt =
type
-tannot_opt =
- Typ_annot_opt_aux of tannot_opt_aux * l
-
-
-type
rec_opt =
Rec_aux of rec_opt_aux * l
@@ -327,6 +327,13 @@ funcl =
type
+val_spec_aux = (* Value type specification *)
+ VS_val_spec of typschm * id
+ | VS_extern_no_rename of typschm * id
+ | VS_extern_spec of typschm * id * string
+
+
+type
type_def_aux = (* Type definition body *)
TD_abbrev of id * name_scm_opt * typschm (* type abbreviation *)
| TD_record of id * name_scm_opt * typquant * ((atyp * id)) list * bool (* struct type definition *)
@@ -336,12 +343,22 @@ type_def_aux = (* Type definition body *)
type
+dec_spec_aux = (* Register declarations *)
+ DEC_reg of atyp * id
+
+
+type
default_typing_spec_aux = (* Default kinding or typing assumption *)
DT_kind of base_kind * kid
| DT_typ of typschm * id
type
+fundef_aux = (* Function definition *)
+ FD_function of rec_opt * tannot_opt * effect_opt * (funcl) list
+
+
+type
scattered_def_aux = (* Function and type union definitions that can be spread across
a file. Each one must end in $_$ *)
SD_scattered_function of rec_opt * tannot_opt * effect_opt * id (* scattered function definition header *)
@@ -352,15 +369,8 @@ scattered_def_aux = (* Function and type union definitions that can be spread a
type
-val_spec_aux = (* Value type specification *)
- VS_val_spec of typschm * id
- | VS_extern_no_rename of typschm * id
- | VS_extern_spec of typschm * id * string
-
-
-type
-fundef_aux = (* Function definition *)
- FD_function of rec_opt * tannot_opt * effect_opt * (funcl) list
+val_spec =
+ VS_aux of val_spec_aux * l
type
@@ -369,44 +379,34 @@ type_def =
type
-default_typing_spec =
- DT_aux of default_typing_spec_aux * l
+dec_spec =
+ DEC_aux of dec_spec_aux * l
type
-scattered_def =
- SD_aux of scattered_def_aux * l
+default_typing_spec =
+ DT_aux of default_typing_spec_aux * l
type
-val_spec =
- VS_aux of val_spec_aux * l
+fundef =
+ FD_aux of fundef_aux * l
type
-fundef =
- FD_aux of fundef_aux * l
+scattered_def =
+ SD_aux of scattered_def_aux * l
type
-def_aux = (* Top-level definition *)
+def = (* Top-level definition *)
DEF_type of type_def (* type definition *)
| DEF_fundef of fundef (* function definition *)
| DEF_val of letbind (* value definition *)
| DEF_spec of val_spec (* top-level type constraint *)
| DEF_default of default_typing_spec (* default kind and type assumptions *)
| DEF_scattered of scattered_def (* scattered definition *)
- | DEF_reg_dec of atyp * id (* register declaration *)
-
-
-type
-def =
- DEF_aux of def_aux * l
-
-
-type
-defs = (* Definition sequence *)
- Defs of (def) list
+ | DEF_reg_dec of dec_spec (* register declaration *)
type
@@ -421,4 +421,9 @@ and lexp =
LEXP_aux of lexp_aux * l
+type
+defs = (* Definition sequence *)
+ Defs of (def) list
+
+