You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upgrade to OCaml 5.x and LLVM 19 with opaque pointers (#14)
## Summary
- Port codebase from OCaml 4.07 to OCaml 5.x (replace deprecated
`Pervasives.compare`, fix warnings)
- Adapt to LLVM 19 opaque pointer model (explicit type arguments for
`build_load`, `build_gep`, `build_call`, etc.)
- Update build configuration for OCaml 5 compatibility
- Update README with modern installation instructions
## Changes
### OCaml 5.x Compatibility
- Replace `Pervasives.compare` with `compare` in semant.ml,
utilities.ml, codegenutils.ml
- Fix unreachable code warning in coral.ml (`exit 0; ()` → `exit 0`)
- Add `package(unix)` to `_tags` and remove redundant `-lib unix` from
Makefile
### LLVM 19 Opaque Pointers
- All pointer types now use single opaque `ptr` type via `L.pointer_type
context`
- Add explicit type arguments to `build_load`, `build_gep`,
`build_struct_gep`
- Add function type arguments to all `build_call` invocations
- Fix optimized function calls to compute `ftype` explicitly instead of
using `L.type_of`
### Documentation
- Update README installation instructions for OCaml 5.x
- Add Apple Silicon LLVM path (`/opt/homebrew/opt/llvm/bin`)
- Simplify and modernize installation steps
## Test plan
- [x] All 132 regression tests pass
- [x] Build completes with no OCaml warnings
- [x] Tested on macOS with OCaml 5.4.0 and LLVM 19
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ Coral supports Python 3.7 style type annotations, as seen in the add function he
41
41
42
42
The Coral GitHub page provides installers for MacOS and several Linux distributions. **These installers can be found on the [Releases page](https://github.com/jacobaustin123/Coral/releases)**. These require that clang be installed.
43
43
44
-
To build the language from the source, **you must have OCaml 4.07.\*, ocaml-llvm, and clang already installed**. To build Coral from the source with OCaml, ocaml-llvm, and gcc/clang already installed, run:
44
+
To build the language from the source, **you must have OCaml (5.x recommended), ocaml-llvm, and clang already installed**. To build Coral from the source with OCaml, ocaml-llvm, and gcc/clang already installed, run:
@@ -54,27 +54,27 @@ This will generate an executable called coral which acts as a compiler and inter
54
54
```bash
55
55
> brew install opam llvm
56
56
> opam init
57
-
> opam switch create 4.07.1
58
-
> opam install llvm ocamlbuild ocamlfind core
57
+
>eval$(opam env)
58
+
> opam install llvm ocamlbuild ocamlfind
59
59
```
60
60
61
-
If the above fails, you may need to run `eval $(opam env)` after opam init and opam switch. The following may also be useful instead:
61
+
If the above fails, you may need to run `eval $(opam env)` after opam init. You may also need to ensure the LLVM binaries are in your PATH:
62
62
63
63
```bash
64
-
> brew install opam llvm
65
-
> opam depext conf-llvm.6.0.0
66
-
> opam install llvm
67
-
>export PATH=/usr/local/opt/llvm@6/bin:$PATH
64
+
>export PATH=/opt/homebrew/opt/llvm/bin:$PATH# Apple Silicon
65
+
>export PATH=/usr/local/opt/llvm/bin:$PATH# Intel Mac
68
66
```
69
67
70
68
On Linux, follow the OCaml/Opam installation instructions [here](https://opam.ocaml.org/doc/Install.html) for your distribution, install llvm following instructions [here](https://apt.llvm.org/), and then run
71
69
72
-
```
73
-
> sudo apt-get install cmake llvm-10 opam
70
+
```bash
71
+
> sudo apt-get install cmake llvm opam
72
+
> opam init
73
+
>eval$(opam env)
74
74
> opam install llvm ocamlbuild ocamlfind
75
75
```
76
76
77
-
You may need to add the llvm path (on Mac usually /usr/local/opt/llvm@6/bin:$PATH) to your PATH variable using bashrc.
77
+
You may need to add the llvm bin directory to your PATH variable using bashrc or zshrc.
0 commit comments