From f726c992ab2506ae3fb8a52993b2c46a1ae0a3b1 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Thu, 21 Sep 2017 15:54:57 +0100 Subject: Cleaning up the AST and removing redundant and/or unused nodes --- src/parse_ast.ml | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/parse_ast.ml') diff --git a/src/parse_ast.ml b/src/parse_ast.ml index b259611d..1036fab8 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -238,7 +238,6 @@ pat_aux = (* Pattern *) | P_app of id * (pat) list (* union constructor pattern *) | P_record of (fpat) list * bool (* struct pattern *) | P_vector of (pat) list (* vector pattern *) - | P_vector_indexed of ((int * pat)) list (* vector pattern (with explicit indices) *) | P_vector_concat of (pat) list (* concatenated vector pattern *) | P_tup of (pat) list (* tuple pattern *) | P_list of (pat) list (* list pattern *) @@ -267,7 +266,6 @@ exp_aux = (* Expression *) | E_if of exp * exp * exp (* conditional *) | E_for of id * exp * exp * exp * atyp * exp (* loop *) | E_vector of (exp) list (* vector (indexed from 0) *) - | E_vector_indexed of (exp) list * opt_default (* vector (indexed consecutively) *) | E_vector_access of exp * exp (* vector access *) | E_vector_subrange of exp * exp * exp (* subvector extraction *) | E_vector_update of exp * exp * exp (* vector functional update *) -- cgit v1.2.3 From 3d853e394b5bb5aa0862b56cfbb068aef8d2458a Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Thu, 21 Sep 2017 16:12:12 +0100 Subject: Simplify AST by removing LB_val_explicit and replace LB_val_implicit with just LB_val in AST also rename functions in rewriter.ml appropriately. --- src/parse_ast.ml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/parse_ast.ml') diff --git a/src/parse_ast.ml b/src/parse_ast.ml index 1036fab8..cd5edce6 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -318,8 +318,7 @@ and pexp = Pat_aux of pexp_aux * l and letbind_aux = (* Let binding *) - LB_val_explicit of typschm * pat * exp (* value binding, explicit type (pat must be total) *) - | LB_val_implicit of pat * exp (* value binding, implicit type (pat must be total) *) + LB_val of pat * exp (* value binding, implicit type (pat must be total) *) and letbind = LB_aux of letbind_aux * l -- cgit v1.2.3 From e0b1f9a268a18128ab9e45e7ba5a2741a1dab143 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Thu, 21 Sep 2017 16:17:35 +0100 Subject: Change NC_fixed to NC_equal to match NC_not_equal also rename NC_nat_set_bounded to NC_set (it was an int set not a nat set anyway) --- src/parse_ast.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/parse_ast.ml') diff --git a/src/parse_ast.ml b/src/parse_ast.ml index cd5edce6..120a0db6 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -158,11 +158,11 @@ kinded_id_aux = (* optionally kind-annotated identifier *) and n_constraint_aux = (* constraint over kind $_$ *) - NC_fixed of atyp * atyp + NC_equal of atyp * atyp | NC_bounded_ge of atyp * atyp | NC_bounded_le of atyp * atyp | NC_not_equal of atyp * atyp - | NC_nat_set_bounded of kid * (int) list + | NC_set of kid * (int) list | NC_or of n_constraint * n_constraint | NC_and of n_constraint * n_constraint | NC_true -- cgit v1.2.3 From b097466ab11fd035dbfd5c7c51ea0644c62b92da Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Thu, 21 Sep 2017 16:38:25 +0100 Subject: Remove unused kind_def (KD_) nodes from AST --- src/parse_ast.ml | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/parse_ast.ml') diff --git a/src/parse_ast.ml b/src/parse_ast.ml index 120a0db6..1776d510 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -431,11 +431,6 @@ val_spec_aux = (* Value type specification *) type kind_def_aux = (* Definition body for elements of kind; many are shorthands for type\_defs *) KD_abbrev of kind * id * name_scm_opt * typschm (* type abbreviation *) - | KD_record of kind * id * name_scm_opt * typquant * ((atyp * id)) list * bool (* struct type definition *) - | KD_variant of kind * id * name_scm_opt * typquant * (type_union) list * bool (* union type definition *) - | KD_enum of kind * id * name_scm_opt * (id) list * bool (* enumeration type definition *) - | KD_register of kind * id * atyp * atyp * ((index_range * id)) list (* register mutable bitfield type definition *) - type dec_spec_aux = (* Register declarations *) -- cgit v1.2.3 From 669bfc2cd34bda80e69ba6c75edbd3e4d57114cd Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Thu, 21 Sep 2017 18:31:49 +0100 Subject: Refactored AST valspecs into single constructor --- src/parse_ast.ml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/parse_ast.ml') diff --git a/src/parse_ast.ml b/src/parse_ast.ml index 1776d510..73f75919 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -422,10 +422,7 @@ type_def_aux = (* Type definition body *) 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 - | VS_cast_spec of typschm * id + VS_val_spec of typschm * id * string option * bool type -- cgit v1.2.3 From ce905a7bd4b6a25f784f94fd926f818e8827d295 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Tue, 3 Oct 2017 16:16:46 +0100 Subject: Fixes to new parser --- src/parse_ast.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/parse_ast.ml') diff --git a/src/parse_ast.ml b/src/parse_ast.ml index 73f75919..c7365d03 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -234,7 +234,7 @@ pat_aux = (* Pattern *) | P_as of pat * id (* named pattern *) | P_typ of atyp * pat (* typed pattern *) | P_id of id (* identifier *) - | P_var of kid + | P_var of pat * kid (* bind pat to type variable *) | P_app of id * (pat) list (* union constructor pattern *) | P_record of (fpat) list * bool (* struct pattern *) | P_vector of (pat) list (* vector pattern *) -- cgit v1.2.3