Last change
on this file since 2721 was
2721,
checked in by campbell, 8 years ago
|
Give the real error in the driver.
|
File size:
913 bytes
|
Rev | Line | |
---|
[2620] | 1 | open Extracted.Errors |
---|
| 2 | |
---|
| 3 | let rec run g s = |
---|
| 4 | (match Extracted.Cexec.is_final0 s with |
---|
| 5 | | Extracted.Types.None -> |
---|
| 6 | (match Extracted.Cexec.exec_step g s with |
---|
| 7 | | Extracted.IOMonad.Value x -> run g (Extracted.Types.snd x) |
---|
[2721] | 8 | | Extracted.IOMonad.Wrong m -> failwith (Error.errormsg m) |
---|
| 9 | | _ -> failwith "unexpected interaction") |
---|
[2620] | 10 | | Extracted.Types.Some r -> r) |
---|
| 11 | |
---|
| 12 | let convBool = function |
---|
| 13 | | Extracted.Bool.True -> true |
---|
| 14 | | Extracted.Bool.False -> false |
---|
| 15 | |
---|
| 16 | let bv_to_int v = |
---|
| 17 | let rec aux i v = |
---|
| 18 | match v with |
---|
| 19 | | Extracted.Vector.VEmpty -> i |
---|
| 20 | | Extracted.Vector.VCons (_,b,t) -> aux (2*i + (if convBool b then 1 else 0)) t |
---|
| 21 | in aux 0 v |
---|
| 22 | ;; |
---|
| 23 | |
---|
| 24 | let cl = ClightParser.process Sys.argv.(1) in |
---|
| 25 | let OK mid = Extracted.Compiler.front_end cl in |
---|
| 26 | let rtlabs = Extracted.Types.snd mid in |
---|
| 27 | let g = Extracted.Cexec.make_global0 cl in |
---|
| 28 | let OK s0 = Extracted.Cexec.make_initial_state0 cl in |
---|
| 29 | let r = run g s0 in |
---|
| 30 | exit (bv_to_int r) |
---|
Note: See
TracBrowser
for help on using the repository browser.