source:
src/acc-matita-printers.patch
@
3049
Last change on this file since 3049 was 1633, checked in by , 9 years ago | |
---|---|
File size: 7.1 KB |
-
Deliverables/D2.2/8051/src/acc.ml
diff --git a/Deliverables/D2.2/8051/src/acc.ml b/Deliverables/D2.2/8051/src/acc.ml index 0a95ef0..56d0cb9 100644
a b let process filename = 27 27 let tgt_language = Options.get_target_language () in 28 28 let is_lustre_file = Options.is_lustre_file () in 29 29 let remove_lustre_externals = Options.is_remove_lustre_externals () in 30 let input_ast =31 Languages.parse ~is_lustre_file ~remove_lustre_externals32 src_language filename in33 let input_ast = Languages.add_runtime input_ast in34 let input_ast = Languages.labelize input_ast in35 30 let (exact_output, output_filename) = match Options.get_output_files () with 36 31 | None -> (false, filename) 37 32 | Some filename' -> (true, filename') in 38 let save ?(suffix="") ast =39 Languages.save 33 let save ?(suffix="") ?(matita=false) ast = 34 Languages.save ~matita 40 35 (Options.is_asm_pretty ()) exact_output output_filename suffix ast 41 36 in 37 let input_ast = 38 Languages.parse ~is_lustre_file ~remove_lustre_externals 39 src_language filename in 40 if tgt_language = Languages.Clight && 41 Options.is_matita_output_enabled () then save ~matita:true input_ast; 42 let input_ast = Languages.add_runtime input_ast in 43 let input_ast = Languages.labelize input_ast in 42 44 let target_asts = 43 45 (** If debugging is enabled, the compilation function returns all 44 46 the intermediate programs. *) … … let process filename = 49 51 in 50 52 let final_ast, intermediate_asts = Misc.ListExt.cut_last target_asts in 51 53 save final_ast; 54 if tgt_language <> Languages.Clight && 55 Options.is_matita_output_enabled () then save ~matita:true final_ast; 52 56 if Options.annotation_requested () then 53 57 begin 54 58 let (annotated_input_ast, cost_id, cost_incr, extern_cost_variables) = … … let process filename = 59 63 extern_cost_variables); 60 64 end; 61 65 62 if Options.is_debug_enabled () then 66 if Options.is_debug_enabled () then begin 63 67 List.iter save intermediate_asts; 68 if Options.is_matita_output_enabled () then 69 List.iter (save ~matita:true) intermediate_asts 70 end; 64 71 65 72 if Options.interpretations_requested () then 66 73 begin -
Deliverables/D2.2/8051/src/clight/clightFromC.ml
diff --git a/Deliverables/D2.2/8051/src/clight/clightFromC.ml b/Deliverables/D2.2/8051/src/clight/clightFromC.ml index 0b54437..1c84dca 100644
a b let ezero = Expr(Econst_int(0), Tint(I32, AST.Signed)) 272 272 let rec convertExpr env e = 273 273 let ty = convertTyp env e.etyp in 274 274 match e.edesc with 275 | C.EConst(C.CInt(i, _, _)) when i = Int64.zero && ty = Tpointer Tvoid -> 276 Expr(Ecast (ty, Expr (Econst_int 0, Tint (I8, AST.Unsigned))), ty) 275 277 | C.EConst(C.CInt(i, _, _)) -> 276 278 Expr(Econst_int( convertInt i), ty) 277 279 | C.EConst(C.CFloat(f, _, _)) -> -
Deliverables/D2.2/8051/src/driver.ml
diff --git a/Deliverables/D2.2/8051/src/driver.ml b/Deliverables/D2.2/8051/src/driver.ml index 759eafd..e0bfd69 100644
a b 4 4 5 5 module DataSize32 = 6 6 struct 7 let alignment = Some 47 let alignment = Some 1 8 8 let int_size = 4 9 let ptr_size = 49 let ptr_size = 2 10 10 end 11 11 12 12 (* The target architecture: the Intel 8051. *) -
Deliverables/D2.2/8051/src/languages.ml
diff --git a/Deliverables/D2.2/8051/src/languages.ml b/Deliverables/D2.2/8051/src/languages.ml index 3048d99..ef7b876 100644
a b let string_output asm_pretty = function 257 257 else ["Pretty print not requested"]) @ 258 258 [ASMPrinter.print_program p] 259 259 260 let save asm_pretty exact_output filename suffix ast = 260 let string_output_matita = function 261 | AstClight p -> 262 [ClightPrintMatita.print_program p] 263 | AstCminor p -> 264 [CminorMatitaPrinter.print_program p] 265 | AstRTLabs p -> 266 [RTLabsPrinter.print_program p] 267 (*[RTLabsMatitaPrinter.print_program p]*) 268 | AstRTL p -> 269 [RTLPrinter.print_program p] 270 | AstERTL p -> 271 [ERTLPrinter.print_program p] 272 | AstLTL p -> 273 [LTLPrinter.print_program p] 274 | AstLIN p -> 275 [LINPrinter.print_program p] 276 | AstASM p -> 277 [Pretty.print_program p ; ASMPrinter.print_program p] 278 279 let save asm_pretty ?(matita=false) exact_output filename suffix ast = 261 280 let ext_chopped_filename = 262 281 if exact_output then filename 263 282 else … … let save asm_pretty exact_output filename suffix ast = 265 284 with Invalid_argument ("Filename.chop_extension") -> filename in 266 285 let ext_chopped_filename = ext_chopped_filename ^ suffix in 267 286 let ext_filenames = 268 List.map (fun ext -> ext_chopped_filename ^ "." ^ ext) 287 List.map (fun ext -> 288 if matita then ext_chopped_filename ^ "." ^ ext ^ ".ma" 289 else ext_chopped_filename ^ "." ^ ext) 269 290 (extension (language_of_ast ast)) in 270 291 let output_filenames = 271 292 if exact_output then ext_filenames 272 293 else List.map Misc.SysExt.alternative ext_filenames in 273 let output_strings = string_output asm_pretty ast in 294 let output_strings = 295 if matita then string_output_matita ast 296 else string_output asm_pretty ast in 274 297 let f filename s = 275 298 let cout = open_out filename in 276 299 output_string cout s; -
Deliverables/D2.2/8051/src/languages.mli
diff --git a/Deliverables/D2.2/8051/src/languages.mli b/Deliverables/D2.2/8051/src/languages.mli index 26b5a0f..121c53f 100644
a b val interpret : bool -> ast -> AST.trace 90 90 whose extension is deduced from the language of the AST. If [exact_output] 91 91 is false then the written file will be fresh. If [asm_pretty] is true, then 92 92 an additional pretty-printed assembly file is output. *) 93 val save : bool -> bool -> string -> string -> ast -> unit93 val save : bool -> ?matita:bool -> bool -> string -> string -> ast -> unit 94 94 95 95 (** [save_cost exact_name filename cost_id cost_incr extern_cost_variables] 96 96 prints the name [cost_id] of the cost variable, then the name [cost_incr] of -
Deliverables/D2.2/8051/src/options.ml
diff --git a/Deliverables/D2.2/8051/src/options.ml b/Deliverables/D2.2/8051/src/options.ml index 77a7735..b4a2d05 100644
a b let set_lustre_test_max_int = (:=) lustre_test_max_int 98 98 let get_lustre_test_max_int () = !lustre_test_max_int 99 99 100 100 101 let matita_flag = ref false 102 let is_matita_output_enabled () = !matita_flag 103 101 104 (* 102 105 let print_result_flag = ref false 103 106 let set_print_result = (:=) print_result_flag … … let options = OptionsParsing.register [ 233 236 234 237 "-dev", Arg.Set dev_test, 235 238 " Playground for developers."; 239 240 "-m", Arg.Set matita_flag, 241 " Output matita term (when available)."; 236 242 ] -
Deliverables/D2.2/8051/src/options.mli
diff --git a/Deliverables/D2.2/8051/src/options.mli b/Deliverables/D2.2/8051/src/options.mli index 2f75755..3af36c9 100644
a b val is_print_result_enabled : unit -> bool 75 75 76 76 (** {2 Developers' playground} *) 77 77 val is_dev_test_enabled : unit -> bool 78 79 (** {2 Output matita term when available} *) 80 val is_matita_output_enabled : unit -> bool
Note: See TracBrowser
for help on using the repository browser.