54 lines
1.3 KiB
OCaml
54 lines
1.3 KiB
OCaml
(*
|
|
Cours "Sémantique et Application à la Vérification de programmes"
|
|
|
|
Antoine Miné 2015
|
|
Marc Chevalier 2018
|
|
Josselin Giet 2021
|
|
Ecole normale supérieure, Paris, France / CNRS / INRIA
|
|
*)
|
|
|
|
|
|
(*
|
|
Command line parsing utility
|
|
*)
|
|
|
|
module IMap = Map.Make(String)
|
|
|
|
open Arg
|
|
|
|
(* Flags *)
|
|
let verbose = ref false
|
|
let disjunction = ref true
|
|
(* string arguments *)
|
|
let file = ref ""
|
|
let cfg_out = ref "cfg.dot"
|
|
let domain = ref ""
|
|
|
|
let args = [
|
|
"-v", Set verbose,
|
|
" Execute the analyzer in verbose/debug mode";
|
|
"--dot-out", Set_string cfg_out,
|
|
" Print the cfg in this file (default is cfg.dot)";
|
|
"--domain", Set_string domain,
|
|
" Select the abstract domain (constants/interval/signs/congruence/product)";
|
|
"-fno-disjunction", Clear disjunction,
|
|
" Disable disjunctive path analysis"
|
|
] |> align
|
|
|
|
let usage = "usage: ./analyzer.exe [options] filename.c"
|
|
|
|
let init () =
|
|
let _ = parse args ( (:=) file) usage in
|
|
let _ = if Filename.extension !file <> ".c" then begin
|
|
Format.eprintf "file should have extension .c file: \"%s\"\n" !file;
|
|
Arg.usage args usage;
|
|
exit 1
|
|
end
|
|
in
|
|
let _ = if Filename.extension !cfg_out <> ".dot" then begin
|
|
Format.eprintf "CFG output file should have extension .dot (%s)\n" !cfg_out;
|
|
Arg.usage args usage;
|
|
exit 1
|
|
end
|
|
in ()
|
|
|