[2828] | 1 | include "compiler.ma". |
---|
| 2 | include "Clight/Clight_classified_system.ma". |
---|
| 3 | include "Cminor/Cminor_classified_system.ma". |
---|
| 4 | include "RTLabs/RTLabs_classified_system.ma". |
---|
| 5 | include "joint/joint_fullexec.ma". |
---|
| 6 | include "RTL/RTL_semantics.ma". |
---|
| 7 | include "ERTL/ERTL_semantics.ma". |
---|
| 8 | include "ERTLptr/ERTLptr_semantics.ma". |
---|
| 9 | include "LTL/LTL_semantics.ma". |
---|
| 10 | include "LIN/LIN_semantics.ma". |
---|
[2875] | 11 | include "ASM/Interpret2.ma". |
---|
[2828] | 12 | |
---|
| 13 | record preclassified_system_pass (P:pass) : Type[2] ≝ |
---|
| 14 | { pcs_pcs:> preclassified_system |
---|
| 15 | ; pcs_ok: syntax_of_pass P = program … pcs_pcs |
---|
| 16 | }. |
---|
| 17 | |
---|
| 18 | definition preclassified_system_of_pass: |
---|
[2875] | 19 | ∀pass. syntax_of_pass pass → preclassified_system_pass pass ≝ |
---|
[2828] | 20 | λpass. |
---|
[2875] | 21 | match pass return λpass.syntax_of_pass pass → preclassified_system_pass pass with |
---|
| 22 | [ clight_pass ⇒ λ_.mk_preclassified_system_pass … Clight_pcs … |
---|
| 23 | | clight_switch_removed_pass ⇒ λ_.mk_preclassified_system_pass … Clight_pcs … |
---|
| 24 | | clight_label_pass ⇒ λ_.mk_preclassified_system_pass … Clight_pcs … |
---|
| 25 | | clight_simplified_pass ⇒ λ_.mk_preclassified_system_pass … Clight_pcs … |
---|
| 26 | | cminor_pass ⇒ λ_.mk_preclassified_system_pass … Cminor_pcs … |
---|
| 27 | | rtlabs_pass ⇒ λ_.mk_preclassified_system_pass … RTLabs_pcs … |
---|
[2828] | 28 | | rtl_separate_pass ⇒ |
---|
[2875] | 29 | λ_.mk_preclassified_system_pass … (joint_preclassified_system RTL_semantics_separate) … |
---|
[2828] | 30 | | rtl_uniq_pass ⇒ |
---|
[2875] | 31 | λ_.mk_preclassified_system_pass … (joint_preclassified_system RTL_semantics_unique) … |
---|
[2828] | 32 | | ertl_pass ⇒ |
---|
[2875] | 33 | λ_.mk_preclassified_system_pass … (joint_preclassified_system ERTL_semantics) … |
---|
[2828] | 34 | | ertlptr_pass ⇒ |
---|
[2875] | 35 | λ_.mk_preclassified_system_pass … (joint_preclassified_system ERTLptr_semantics) … |
---|
[2828] | 36 | | ltl_pass ⇒ |
---|
[2875] | 37 | λ_.mk_preclassified_system_pass … (joint_preclassified_system LTL_semantics) … |
---|
[2828] | 38 | | lin_pass ⇒ |
---|
[2875] | 39 | λ_.mk_preclassified_system_pass lin_pass (joint_preclassified_system LIN_semantics) ? |
---|
| 40 | | assembly_pass ⇒ |
---|
[2899] | 41 | λprog. let 〈code,sigma,policy〉 ≝ prog in |
---|
[2905] | 42 | mk_preclassified_system_pass … (ASM_preclassified_system code sigma policy) … |
---|
[2875] | 43 | | object_code_pass ⇒ |
---|
| 44 | λprog. mk_preclassified_system_pass ? (OC_preclassified_system prog) … |
---|
[2828] | 45 | ]. |
---|
[2899] | 46 | % |
---|
[2828] | 47 | qed. |
---|
| 48 | |
---|
| 49 | definition run_and_print: |
---|
| 50 | ∀pass'. syntax_of_pass pass' → nat → |
---|
| 51 | (pass → unit) → (intensional_event → unit) → (errmsg → unit) → (int → unit) → unit |
---|
| 52 | ≝ |
---|
| 53 | λpass,prog,n,print_pass,print_event,print_error,print_exit. |
---|
[2875] | 54 | let pcs ≝ preclassified_system_of_pass pass prog in |
---|
[2828] | 55 | let prog ≝ prog⌈syntax_of_pass pass ↦ ?⌉ in |
---|
| 56 | let g ≝ make_global … pcs prog in |
---|
| 57 | match make_initial_state … pcs prog with |
---|
| 58 | [ Error msg ⇒ print_error msg |
---|
| 59 | | OK s0 ⇒ |
---|
| 60 | let i ≝ print_pass pass in |
---|
| 61 | let 〈trace,res〉 ≝ observe_all_in_measurable n (pcs_to_cs pcs …) print_event [ ] s0 in |
---|
| 62 | match res with |
---|
| 63 | [ OK n ⇒ print_exit n |
---|
| 64 | | Error msg ⇒ print_error msg ]]. |
---|
| 65 | @pcs_ok |
---|
[2899] | 66 | qed. |
---|