diff --git a/byterun/., b/byterun/., deleted file mode 100644 index 27657559f..000000000 --- a/byterun/., +++ /dev/null @@ -1,12 +0,0 @@ - -all: gc_runtime.o runtime.o - ar rc runtime.a gc_runtime.o runtime.o - -gc_runtime.o: gc_runtime.s - $(CC) -g -fstack-protector-all -m32 -c gc_runtime.s - -runtime.o: runtime.c - $(CC) -g -fstack-protector-all -m32 -c runtime.c - -clean: - $(RM) *.a *.o *~ diff --git a/byterun/.gitignore b/byterun/.gitignore new file mode 100644 index 000000000..68995d9a0 --- /dev/null +++ b/byterun/.gitignore @@ -0,0 +1 @@ +/byterun.exe \ No newline at end of file diff --git a/byterun/dune b/byterun/dune new file mode 100644 index 000000000..21ba79084 --- /dev/null +++ b/byterun/dune @@ -0,0 +1,9 @@ +(rule + (target byterun.exe) + (deps + (:main byterun.c) + (:runtime ../runtime/runtime.a)) + (mode + (promote (until-clean))) + (action + (run gcc -g %{main} %{runtime} -o %{target}))) diff --git a/performance/.gitignore b/performance/.gitignore new file mode 100644 index 000000000..680a34d17 --- /dev/null +++ b/performance/.gitignore @@ -0,0 +1 @@ +/*.exe \ No newline at end of file diff --git a/performance/dune b/performance/dune new file mode 100644 index 000000000..d0dc1ca8c --- /dev/null +++ b/performance/dune @@ -0,0 +1,21 @@ +(rule + (targets Sort.x64.exe) + (deps + (:lama Sort.lama) + ../runtime/runtime.a) + (mode + (promote (until-clean))) + (action + (setenv + LAMA + "../runtime" + (run + %{project_root}/src/Driver.exe + -march=x86_64 + %{lama} + -I + ../stdlib/x64 + -I + ../runtime + -o + %{targets})))) diff --git a/src/Driver.ml b/src/Driver.ml index b0aade41c..a5bcdd6c5 100644 --- a/src/Driver.ml +++ b/src/Driver.ml @@ -21,7 +21,9 @@ let[@ocaml.warning "-32"] main = let rec read acc = try let r = read_int () in - Printf.printf "> "; + Printf.printf " > "; + (* NOTE(Kakadu): This kind of ouput (leading >) will be in a conflict with dune's + integration tests machinery *) read (r :: acc) with End_of_file -> List.rev acc in diff --git a/stdlib/x32/dune b/stdlib/x32/dune index b4f27d222..521a7b7de 100644 --- a/stdlib/x32/dune +++ b/stdlib/x32/dune @@ -1,7 +1,7 @@ (rule (deps ../Makefile - ../../runtime/Std.i + ../../runtime32/Std.i ../List.lama ../Array.lama ../Buffer.lama diff --git a/tools/dune b/tools/dune new file mode 100644 index 000000000..03be1811b --- /dev/null +++ b/tools/dune @@ -0,0 +1,9 @@ +(executable + (name tool) + (modules tool) + (flags + (:standard -rectypes)) + (libraries liba)) + +(cram + (deps ../runtime/runtime.a ../runtime/Std.i ./tool.exe demo1.lama)) diff --git a/tools/run.t b/tools/run.t new file mode 100644 index 000000000..1fa10a513 --- /dev/null +++ b/tools/run.t @@ -0,0 +1,4 @@ + $ LAMA=../runtime ./tool.exe demo1.lama -pos 5,22 -use + found definition for `f` at (1,19) + Total 2 usages found + (5,24) (5,22) diff --git a/tools/tool.ml b/tools/tool.ml index 8e4ab1ec7..0bc43ea39 100644 --- a/tools/tool.ml +++ b/tools/tool.ml @@ -14,9 +14,10 @@ type config = ; mutable line : int ; mutable col: int ; mutable mode: mode + ; mutable includes : string list } -let config = { filename= "file.ml"; pos="0,0"; line=0; col=0; mode = GoToDef } +let config = { filename= "file.ml"; pos="0,0"; line=0; col=0; mode = GoToDef; includes = ["."; "./runtime"] } let _ = if false then config.pos <- "" else ignore config.pos let parse_loc loc = Scanf.sscanf loc "%d,%d" (fun l c -> config.line <- l; config.col <- c) @@ -26,6 +27,7 @@ let () = [ "-pos", String parse_loc, "L,C when L is line and C is column" ; "-def", Unit (fun () -> config.mode <- GoToDef), "go to definition" ; "-use", Unit (fun () -> config.mode <- Usages), "find usages" + ; "-I", String (fun s -> config.includes <- s :: config.includes), " Add include path" ] (fun name -> config.filename <- name) "Help" @@ -118,7 +120,10 @@ let find_usages root (def_name,(_,_)) = let () = let cfg = object - method get_include_paths = ["."; "./runtime"] method get_infile = config.filename method is_workaround=false end + method get_include_paths = ["."; "./runtime"; "../runtime"] + method get_infile = config.filename + method is_workaround = false + end in match Language.run_parser cfg with | `Fail s -> failwith s diff --git a/tutorial/dune b/tutorial/dune index 1a7ea7bbe..a2c4d1580 100644 --- a/tutorial/dune +++ b/tutorial/dune @@ -1,7 +1,7 @@ (rule (targets Expressions.x32.exe) - (deps (:lama Expressions.lama) ../runtime32/runtime.a) + (deps (:lama Expressions.lama) ../runtime32/runtime.a ../stdlib/x32/Fun.i) (mode (promote (until-clean))) (action @@ -21,7 +21,7 @@ (rule (targets Expressions.x64.exe) - (deps (:lama Expressions.lama) ../runtime/runtime.a) + (deps (:lama Expressions.lama) ../runtime/runtime.a ../stdlib/x64/Fun.i) (mode (promote (until-clean))) (action @@ -41,7 +41,7 @@ (rule (targets Functions.x32.exe) - (deps (:lama Functions.lama) ../runtime32/runtime.a) + (deps (:lama Functions.lama) ../runtime32/runtime.a ../stdlib/x32/Fun.i) (mode (promote (until-clean))) (action @@ -61,7 +61,7 @@ (rule (targets Functions.x64.exe) - (deps (:lama Functions.lama) ../runtime/runtime.a) + (deps (:lama Functions.lama) ../runtime/runtime.a ../stdlib/x64/Fun.i) (mode (promote (until-clean))) (action @@ -81,7 +81,7 @@ (rule (targets Hello.x32.exe) - (deps (:lama Hello.lama) ../runtime32/runtime.a) + (deps (:lama Hello.lama) ../runtime32/runtime.a ../stdlib/x32/Fun.i) (mode (promote (until-clean))) (action @@ -101,7 +101,7 @@ (rule (targets Hello.x64.exe) - (deps (:lama Hello.lama) ../runtime/runtime.a) + (deps (:lama Hello.lama) ../runtime/runtime.a ../stdlib/x64/Fun.i) (mode (promote (until-clean))) (action @@ -121,7 +121,7 @@ (rule (targets PatternMatching.x32.exe) - (deps (:lama PatternMatching.lama) ../runtime32/runtime.a) + (deps (:lama PatternMatching.lama) ../runtime32/runtime.a ../stdlib/x32/Fun.i) (mode (promote (until-clean))) (action @@ -141,7 +141,7 @@ (rule (targets PatternMatching.x64.exe) - (deps (:lama PatternMatching.lama) ../runtime/runtime.a) + (deps (:lama PatternMatching.lama) ../runtime/runtime.a ../stdlib/x64/Fun.i) (mode (promote (until-clean))) (action @@ -161,7 +161,7 @@ (rule (targets Values.x32.exe) - (deps (:lama Values.lama) ../runtime32/runtime.a) + (deps (:lama Values.lama) ../runtime32/runtime.a ../stdlib/x32/Fun.i) (mode (promote (until-clean))) (action @@ -181,7 +181,7 @@ (rule (targets Values.x64.exe) - (deps (:lama Values.lama) ../runtime/runtime.a) + (deps (:lama Values.lama) ../runtime/runtime.a ../stdlib/x64/Fun.i) (mode (promote (until-clean))) (action diff --git a/tutorial/gen.ml b/tutorial/gen.ml index 90abb451e..2a463f972 100644 --- a/tutorial/gen.ml +++ b/tutorial/gen.ml @@ -5,7 +5,7 @@ let demos = ["Expressions"; "Functions"; "Hello"; "PatternMatching"; "Values"] let template = {| (rule (targets %DEMO%.exe) - (deps (:lama %DEMOSRC%.lama) %RUNTIME%/runtime.a) + (deps (:lama %DEMOSRC%.lama) %RUNTIME%/runtime.a %STDLIB%/Fun.i) (mode (promote (until-clean))) (action