Commit e8a8118d authored by David Hauzar's avatar David Hauzar

Counterexamples for bitvectors.

Parsing bitvectors in the counterexample returned by the prover.
parent c5d3d0f4
......@@ -30,6 +30,7 @@ let debug = Debug.register_info_flag "model_parser"
type model_value =
| Integer of string
| Array of model_array
| Bitvector of int
| Unparsed of string
and arr_index = {
arr_index_key : int;
......@@ -82,6 +83,7 @@ print_model_value_sanit sanit_print fmt value =
| Integer s -> sanit_print fmt s
| Unparsed s -> sanit_print fmt s
| Array a -> print_array sanit_print fmt a
| Bitvector v -> sanit_print fmt (string_of_int v)
let print_model_value fmt value =
print_model_value_sanit (fun fmt s -> fprintf fmt "%s" s) fmt value
......
......@@ -17,6 +17,7 @@
type model_value =
| Integer of string
| Array of model_array
| Bitvector of int
| Unparsed of string
and arr_index = {
arr_index_key : int;
......
......@@ -5,6 +5,7 @@
let atom = [^'('')'' ''\t''\n']
let space = [' ''\t''\n']
let num = ['0'-'9']+
rule token = parse
| '\n'
......@@ -18,8 +19,9 @@ rule token = parse
{ LPAREN }
| ')'
{ RPAREN }
| ['0'-'9']+ as integer
| num as integer
{ INT_STR (integer) }
| "(_ bv"(num as bv_value)" "num")" { BITVECTOR_VALUE (int_of_string bv_value) }
| '-'space*(['0'-'9']+ as integer) { MINUS_INT_STR ("-"^integer) }
| atom+ as at { ATOM (at) }
| eof
......@@ -27,4 +29,3 @@ rule token = parse
(* | space { SPACE } *)
| _
{ raise SyntaxError }
......@@ -2,13 +2,13 @@
%}
%start <Model_parser.model_element list> output
%token <string> SPACE
%token <string> ATOM
%token STORE
%token CONST
%token AS
%token <string> INT_STR
%token <int> BITVECTOR_VALUE
%token <string> MINUS_INT_STR
%token LPAREN RPAREN
%token EOF
......@@ -54,6 +54,7 @@ value:
| integer { $1 }
| other_val_str { Model_parser.Unparsed $1 }
| array { Model_parser.Array $1 }
| bitvector { Model_parser.Bitvector $1 }
integer:
| INT_STR { Model_parser.Integer $1 }
......@@ -101,5 +102,11 @@ array:
RPAREN
{ Model_parser.array_add_element ~array:$5 ~index:$7 ~value:$9 }
(* Example:
(_ bv2048 16) *)
bitvector:
| BITVECTOR_VALUE
{ $1 }
array_skipped_part:
| LPAREN term_list RPAREN {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment