diff options
| author | Kathy Gray | 2013-09-09 13:59:38 +0100 |
|---|---|---|
| committer | Kathy Gray | 2013-09-09 13:59:38 +0100 |
| commit | 7cb63f193a74b82a6ca2529dbf09d31b20a6bc28 (patch) | |
| tree | 53333d2a3b9f7f1dd8c5332cbf3a32eda1728f5a /src/parse_ast.ml | |
| parent | cf4c7c0fd5fb8a9851fa6ca325d1b106ff080fd5 (diff) | |
Pretty printer to Lem ast added; accessed by -lem_ast on the command line
Diffstat (limited to 'src/parse_ast.ml')
| -rw-r--r-- | src/parse_ast.ml | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/src/parse_ast.ml b/src/parse_ast.ml index e0c75495..23957118 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -25,12 +25,6 @@ base_kind_aux = (* base kind *) type -id_aux = (* Identifier *) - Id of x - | DeIid of x (* remove infix status *) - - -type efct_aux = (* effect *) Effect_rreg (* read register *) | Effect_wreg (* write register *) @@ -42,13 +36,14 @@ efct_aux = (* effect *) type -base_kind = - BK_aux of base_kind_aux * l +id_aux = (* Identifier *) + Id of x + | DeIid of x (* remove infix status *) type -id = - Id_aux of id_aux * l +base_kind = + BK_aux of base_kind_aux * l type @@ -57,6 +52,11 @@ efct = type +id = + Id_aux of id_aux * l + + +type kind_aux = (* kinds *) K_kind of (base_kind) list @@ -128,11 +128,6 @@ typquant_aux = (* type quantifiers and constraints *) type -typquant = - TypQ_aux of typquant_aux * l - - -type lit_aux = (* Literal constant *) L_unit (* $() : _$ *) | L_zero (* $_ : _$ *) @@ -146,8 +141,8 @@ lit_aux = (* Literal constant *) type -typschm_aux = (* type scheme *) - TypSchm_ts of typquant * atyp +typquant = + TypQ_aux of typquant_aux * l type @@ -156,8 +151,8 @@ lit = type -typschm = - TypSchm_aux of typschm_aux * l +typschm_aux = (* type scheme *) + TypSchm_ts of typquant * atyp type @@ -186,6 +181,11 @@ and fpat = type +typschm = + TypSchm_aux of typschm_aux * l + + +type exp_aux = (* Expression *) E_block of (exp) list (* block (parsing conflict with structs?) *) | E_id of id (* identifier *) @@ -253,25 +253,20 @@ tannot_opt_aux = (* Optional type annotation for functions *) type -rec_opt_aux = (* Optional recursive annotation for functions *) - Rec_nonrec (* non-recursive *) - | Rec_rec (* recursive *) - - -type effects_opt_aux = (* Optional effect annotation for functions *) Effects_opt_pure (* sugar for empty effect set *) | Effects_opt_effects of atyp type -funcl_aux = (* Function clause *) - FCL_Funcl of id * pat * exp +rec_opt_aux = (* Optional recursive annotation for functions *) + Rec_nonrec (* non-recursive *) + | Rec_rec (* recursive *) type -naming_scheme_opt = - Name_sect_aux of naming_scheme_opt_aux * l +funcl_aux = (* Function clause *) + FCL_Funcl of id * pat * exp type @@ -285,13 +280,13 @@ and index_range = type -tannot_opt = - Typ_annot_opt_aux of tannot_opt_aux * l +naming_scheme_opt = + Name_sect_aux of naming_scheme_opt_aux * l type -rec_opt = - Rec_aux of rec_opt_aux * l +tannot_opt = + Typ_annot_opt_aux of tannot_opt_aux * l type @@ -300,11 +295,21 @@ effects_opt = type +rec_opt = + Rec_aux of rec_opt_aux * l + + +type funcl = FCL_aux of funcl_aux * l type +val_spec_aux = (* Value type specification *) + VS_val_spec of typschm * id + + +type type_def_aux = (* Type definition body *) TD_abbrev of id * naming_scheme_opt * typschm (* type abbreviation *) | TD_record of id * naming_scheme_opt * typquant * ((atyp * id)) list * bool (* struct type definition *) @@ -314,34 +319,24 @@ type_def_aux = (* Type definition body *) type -fundef_aux = (* Function definition *) - FD_function of rec_opt * tannot_opt * effects_opt * (funcl) list - - -type -val_spec_aux = (* Value type specification *) - VS_val_spec of typschm * id - - -type default_typing_spec_aux = (* Default kinding or typing assumption *) DT_kind of base_kind * id | DT_typ of typschm * id type -type_def = - TD_aux of type_def_aux * l +fundef_aux = (* Function definition *) + FD_function of rec_opt * tannot_opt * effects_opt * (funcl) list type -fundef = - FD_aux of fundef_aux * l +val_spec = + VS_aux of val_spec_aux * l type -val_spec = - VS_aux of val_spec_aux * l +type_def = + TD_aux of type_def_aux * l type @@ -350,6 +345,11 @@ default_typing_spec = type +fundef = + FD_aux of fundef_aux * l + + +type def_aux = (* Top-level definition *) DEF_type of type_def (* type definition *) | DEF_fundef of fundef (* function definition *) @@ -365,6 +365,16 @@ def_aux = (* Top-level definition *) type +def = + DEF_aux of def_aux * l + + +type +ctor_def_aux = (* Datatype constructor definition clause *) + CT_ct of id * typschm + + +type typ_lib_aux = (* library types and syntactic sugar for them *) Typ_lib_unit (* unit type with value $()$ *) | Typ_lib_bool (* booleans $_$ and $_$ *) @@ -383,26 +393,6 @@ typ_lib_aux = (* library types and syntactic sugar for them *) type -ctor_def_aux = (* Datatype constructor definition clause *) - CT_ct of id * typschm - - -type -def = - DEF_aux of def_aux * l - - -type -typ_lib = - Typ_lib_aux of typ_lib_aux * l - - -type -ctor_def = - CT_aux of ctor_def_aux * l - - -type lexp_aux = (* lvalue expression *) LEXP_id of id (* identifier *) | LEXP_vector of lexp * exp (* vector element *) @@ -418,4 +408,14 @@ defs = (* Definition sequence *) Defs of (def) list +type +ctor_def = + CT_aux of ctor_def_aux * l + + +type +typ_lib = + Typ_lib_aux of typ_lib_aux * l + + |
