mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
Minor fixes of minor tools
Signed-off-by: Kakadu <Kakadu@pm.me>
This commit is contained in:
parent
f6277da16e
commit
d3d2535f97
12 changed files with 67 additions and 27 deletions
12
byterun/.,
12
byterun/.,
|
|
@ -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 *~
|
|
||||||
1
byterun/.gitignore
vendored
Normal file
1
byterun/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/byterun.exe
|
||||||
9
byterun/dune
Normal file
9
byterun/dune
Normal file
|
|
@ -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})))
|
||||||
1
performance/.gitignore
vendored
Normal file
1
performance/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/*.exe
|
||||||
21
performance/dune
Normal file
21
performance/dune
Normal file
|
|
@ -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}))))
|
||||||
|
|
@ -21,7 +21,9 @@ let[@ocaml.warning "-32"] main =
|
||||||
let rec read acc =
|
let rec read acc =
|
||||||
try
|
try
|
||||||
let r = read_int () in
|
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)
|
read (r :: acc)
|
||||||
with End_of_file -> List.rev acc
|
with End_of_file -> List.rev acc
|
||||||
in
|
in
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
(rule
|
(rule
|
||||||
(deps
|
(deps
|
||||||
../Makefile
|
../Makefile
|
||||||
../../runtime/Std.i
|
../../runtime32/Std.i
|
||||||
../List.lama
|
../List.lama
|
||||||
../Array.lama
|
../Array.lama
|
||||||
../Buffer.lama
|
../Buffer.lama
|
||||||
|
|
|
||||||
9
tools/dune
Normal file
9
tools/dune
Normal file
|
|
@ -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))
|
||||||
4
tools/run.t
Normal file
4
tools/run.t
Normal file
|
|
@ -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)
|
||||||
|
|
@ -14,9 +14,10 @@ type config =
|
||||||
; mutable line : int
|
; mutable line : int
|
||||||
; mutable col: int
|
; mutable col: int
|
||||||
; mutable mode: mode
|
; 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 _ = if false then config.pos <- "" else ignore config.pos
|
||||||
let parse_loc loc =
|
let parse_loc loc =
|
||||||
Scanf.sscanf loc "%d,%d" (fun l c -> config.line <- l; config.col <- c)
|
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"
|
[ "-pos", String parse_loc, "L,C when L is line and C is column"
|
||||||
; "-def", Unit (fun () -> config.mode <- GoToDef), "go to definition"
|
; "-def", Unit (fun () -> config.mode <- GoToDef), "go to definition"
|
||||||
; "-use", Unit (fun () -> config.mode <- Usages), "find usages"
|
; "-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)
|
(fun name -> config.filename <- name)
|
||||||
"Help"
|
"Help"
|
||||||
|
|
@ -118,7 +120,10 @@ let find_usages root (def_name,(_,_)) =
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
let cfg = object
|
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
|
in
|
||||||
match Language.run_parser cfg with
|
match Language.run_parser cfg with
|
||||||
| `Fail s -> failwith s
|
| `Fail s -> failwith s
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets Expressions.x32.exe)
|
(targets Expressions.x32.exe)
|
||||||
(deps (:lama Expressions.lama) ../runtime32/runtime.a)
|
(deps (:lama Expressions.lama) ../runtime32/runtime.a ../stdlib/x32/Fun.i)
|
||||||
(mode
|
(mode
|
||||||
(promote (until-clean)))
|
(promote (until-clean)))
|
||||||
(action
|
(action
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets Expressions.x64.exe)
|
(targets Expressions.x64.exe)
|
||||||
(deps (:lama Expressions.lama) ../runtime/runtime.a)
|
(deps (:lama Expressions.lama) ../runtime/runtime.a ../stdlib/x64/Fun.i)
|
||||||
(mode
|
(mode
|
||||||
(promote (until-clean)))
|
(promote (until-clean)))
|
||||||
(action
|
(action
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets Functions.x32.exe)
|
(targets Functions.x32.exe)
|
||||||
(deps (:lama Functions.lama) ../runtime32/runtime.a)
|
(deps (:lama Functions.lama) ../runtime32/runtime.a ../stdlib/x32/Fun.i)
|
||||||
(mode
|
(mode
|
||||||
(promote (until-clean)))
|
(promote (until-clean)))
|
||||||
(action
|
(action
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets Functions.x64.exe)
|
(targets Functions.x64.exe)
|
||||||
(deps (:lama Functions.lama) ../runtime/runtime.a)
|
(deps (:lama Functions.lama) ../runtime/runtime.a ../stdlib/x64/Fun.i)
|
||||||
(mode
|
(mode
|
||||||
(promote (until-clean)))
|
(promote (until-clean)))
|
||||||
(action
|
(action
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets Hello.x32.exe)
|
(targets Hello.x32.exe)
|
||||||
(deps (:lama Hello.lama) ../runtime32/runtime.a)
|
(deps (:lama Hello.lama) ../runtime32/runtime.a ../stdlib/x32/Fun.i)
|
||||||
(mode
|
(mode
|
||||||
(promote (until-clean)))
|
(promote (until-clean)))
|
||||||
(action
|
(action
|
||||||
|
|
@ -101,7 +101,7 @@
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets Hello.x64.exe)
|
(targets Hello.x64.exe)
|
||||||
(deps (:lama Hello.lama) ../runtime/runtime.a)
|
(deps (:lama Hello.lama) ../runtime/runtime.a ../stdlib/x64/Fun.i)
|
||||||
(mode
|
(mode
|
||||||
(promote (until-clean)))
|
(promote (until-clean)))
|
||||||
(action
|
(action
|
||||||
|
|
@ -121,7 +121,7 @@
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets PatternMatching.x32.exe)
|
(targets PatternMatching.x32.exe)
|
||||||
(deps (:lama PatternMatching.lama) ../runtime32/runtime.a)
|
(deps (:lama PatternMatching.lama) ../runtime32/runtime.a ../stdlib/x32/Fun.i)
|
||||||
(mode
|
(mode
|
||||||
(promote (until-clean)))
|
(promote (until-clean)))
|
||||||
(action
|
(action
|
||||||
|
|
@ -141,7 +141,7 @@
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets PatternMatching.x64.exe)
|
(targets PatternMatching.x64.exe)
|
||||||
(deps (:lama PatternMatching.lama) ../runtime/runtime.a)
|
(deps (:lama PatternMatching.lama) ../runtime/runtime.a ../stdlib/x64/Fun.i)
|
||||||
(mode
|
(mode
|
||||||
(promote (until-clean)))
|
(promote (until-clean)))
|
||||||
(action
|
(action
|
||||||
|
|
@ -161,7 +161,7 @@
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets Values.x32.exe)
|
(targets Values.x32.exe)
|
||||||
(deps (:lama Values.lama) ../runtime32/runtime.a)
|
(deps (:lama Values.lama) ../runtime32/runtime.a ../stdlib/x32/Fun.i)
|
||||||
(mode
|
(mode
|
||||||
(promote (until-clean)))
|
(promote (until-clean)))
|
||||||
(action
|
(action
|
||||||
|
|
@ -181,7 +181,7 @@
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets Values.x64.exe)
|
(targets Values.x64.exe)
|
||||||
(deps (:lama Values.lama) ../runtime/runtime.a)
|
(deps (:lama Values.lama) ../runtime/runtime.a ../stdlib/x64/Fun.i)
|
||||||
(mode
|
(mode
|
||||||
(promote (until-clean)))
|
(promote (until-clean)))
|
||||||
(action
|
(action
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ let demos = ["Expressions"; "Functions"; "Hello"; "PatternMatching"; "Values"]
|
||||||
let template = {|
|
let template = {|
|
||||||
(rule
|
(rule
|
||||||
(targets %DEMO%.exe)
|
(targets %DEMO%.exe)
|
||||||
(deps (:lama %DEMOSRC%.lama) %RUNTIME%/runtime.a)
|
(deps (:lama %DEMOSRC%.lama) %RUNTIME%/runtime.a %STDLIB%/Fun.i)
|
||||||
(mode
|
(mode
|
||||||
(promote (until-clean)))
|
(promote (until-clean)))
|
||||||
(action
|
(action
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue