diff options
author | pacien | 2018-04-29 20:24:38 +0200 |
---|---|---|
committer | pacien | 2018-04-29 20:24:38 +0200 |
commit | 0647f37eebbefb8446fc8abfc533a23952fbb8be (patch) | |
tree | fc9d69f32bd6c04de27c3795f6d54ed150bd4958 /main.ml | |
parent | 80d7f0f204aacefa768d34f6db30108cb430cede (diff) | |
download | urm-0647f37eebbefb8446fc8abfc533a23952fbb8be.tar.gz |
Move sources to dedicated directory
Diffstat (limited to 'main.ml')
-rw-r--r-- | main.ml | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/main.ml b/main.ml deleted file mode 100644 index 2f8d57c..0000000 --- a/main.ml +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | (* | ||
2 | * UPEM / L3 / Functional programming / Project: URM | ||
3 | * Pacien TRAN-GIRARD, Adam NAILI | ||
4 | *) | ||
5 | |||
6 | open Common | ||
7 | open Parser | ||
8 | open Instptr | ||
9 | open Reg | ||
10 | open Urm | ||
11 | |||
12 | let exec_with_resource func filename = | ||
13 | let file = open_in filename in | ||
14 | let res = func file in | ||
15 | close_in file; res | ||
16 | |||
17 | let read_prgm = exec_with_resource (fun f -> string_of_file f |> program_of_string) | ||
18 | let read_regs = exec_with_resource (fun f -> string_of_file f |> regs_of_string) | ||
19 | let run run_func prgm regs = urm_mk prgm regs |> run_func |> regs_string |> print_endline | ||
20 | |||
21 | let run_mode_of_string = function | ||
22 | | "run" -> urm_run | ||
23 | | "trace" -> urm_run_trace | ||
24 | | _ -> failwith "Invalid run mode" | ||
25 | |||
26 | let () = match Sys.argv with | ||
27 | | [| _; "run-tests" |] -> () (* handled in test files *) | ||
28 | | [| _; mode; prgm; regs |] -> run (run_mode_of_string mode) (read_prgm prgm) (read_regs regs) | ||
29 | | _ -> print_endline "Usage: urm <run-tests | run <prgmfile> <regfile> | trace <prgmfile> <regfile>>" | ||
30 | |||