summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Kerneis2014-03-20 17:20:13 +0000
committerGabriel Kerneis2014-03-20 17:20:13 +0000
commite5552aeb0c9f41faa2191c49b4cfe81b5bd691b1 (patch)
treef44983b5b7dad3b1b27b77fcb1a0ca13a0092aff /src
parentcc31a8ba8851c301935725a749d2a19620d46abb (diff)
Type bit[n] means bit[0..n-1]
Diffstat (limited to 'src')
-rw-r--r--src/parser.mly6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/parser.mly b/src/parser.mly
index 16d28daa..52b8a8ae 100644
--- a/src/parser.mly
+++ b/src/parser.mly
@@ -111,7 +111,11 @@ let make_vector_sugar_bounded is_inc typ typ1 typ2 =
else make_r typ2 typ1,ATyp_dec in
ATyp_app(Id_aux(Id("vector"),Unknown),[typ1;rise;ATyp_aux(ord,Unknown);typ])
let make_vector_sugar typ typ1 =
- make_vector_sugar_bounded true typ (ATyp_aux(ATyp_constant(0),Unknown)) typ1
+ let sub_one = match typ1 with
+ | ATyp_aux(ATyp_constant t,l) -> ATyp_aux(ATyp_constant (t-1),l)
+ | ATyp_aux(_, l) -> ATyp_aux (ATyp_sum (typ1,
+ ATyp_aux(ATyp_neg(ATyp_aux(ATyp_constant 1,Unknown)), Unknown)), l) in
+ make_vector_sugar_bounded true typ (ATyp_aux(ATyp_constant(0),Unknown)) sub_one
%}