Skip to content

Commit 6d85aad

Browse files
committed
Fix: make it work (test under OCaml 4.12).
The change is from adamrk/llvm-ocaml-tutorial#1. Other changes is made by ocamlformat (default setting).
1 parent 24ad805 commit 6d85aad

File tree

5 files changed

+34
-18
lines changed

5 files changed

+34
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
_build
22
.merlin
33
*.swp
4+
*.so

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Meta
2+
3+
The project is forked from https://github.com/adamrk/llvm-ocaml-tutorial.
4+
5+
## Build
6+
7+
`opam install core async ctypes-foreign llvm menhir`
8+
9+
`export LD_LIBRARY_PATH=/path/to/libbindings.so`.
10+
11+
The path is `_build/default/stubs/libbindings.so` by default.
12+
13+
## Run
14+
15+
`./path/to/bin/kaleidoscope.exe < example/mandel.kal`

bin/dune

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
(executable
22
(name kaleidoscope)
3-
(libraries
4-
async
5-
core
6-
kaleidoscope_lib)
7-
(link_deps (file ../stubs/libbindings.so))
3+
(libraries async core kaleidoscope_lib)
4+
(link_deps
5+
(file ../stubs/libbindings.so))
86
(link_flags -cclib -Lstubs -cclib -lbindings)
9-
(preprocess (pps ppx_jane ppx_expect ppx_let)))
7+
(preprocess
8+
(pps ppx_jane ppx_expect ppx_let)))

bin/kaleidoscope.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ let () =
44
let open Command.Let_syntax in
55
Command.basic ~summary:"Parse and print kaleidoscope"
66
[%map_open
7-
let file = flag "file" (optional file) ~doc:"FILE read input from file" in
7+
let file = flag "file" (optional string) ~doc:"FILE read input from file" in
88
fun () -> Kaleidoscope_lib.Toplevel.main (match file with
99
| None -> `Stdin
1010
| Some file -> `File file)]

lib/dune

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
(library
22
(name kaleidoscope_lib)
3-
(libraries
4-
async
5-
core
6-
ctypes.foreign
7-
llvm
8-
llvm.analysis
9-
llvm.executionengine
10-
llvm.target
11-
llvm.scalar_opts
12-
menhirLib)
13-
(preprocess (pps ppx_jane ppx_expect ppx_let))
3+
(libraries
4+
async
5+
core
6+
ctypes.foreign
7+
llvm
8+
llvm.analysis
9+
llvm.executionengine
10+
llvm.target
11+
llvm.scalar_opts
12+
menhirLib)
13+
(preprocess
14+
(pps ppx_jane -allow-unannotated-ignores ppx_expect ppx_let))
1415
(inline_tests))
1516

1617
(ocamllex lexer)

0 commit comments

Comments
 (0)