Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iskandr/ocaml_llvm
Toy compiler for OCaml Meetup
https://github.com/iskandr/ocaml_llvm
Last synced: about 2 months ago
JSON representation
Toy compiler for OCaml Meetup
- Host: GitHub
- URL: https://github.com/iskandr/ocaml_llvm
- Owner: iskandr
- License: gpl-2.0
- Created: 2012-02-22T16:03:18.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2012-02-25T01:01:18.000Z (almost 13 years ago)
- Last Synced: 2024-10-31T19:25:04.361Z (about 2 months ago)
- Language: OCaml
- Homepage:
- Size: 125 KB
- Stars: 68
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: license.txt
Awesome Lists containing this project
README
Here's toy language for 32-bit float computations in OCaml.
For example, if you want to compute the n'th harmonic number, you could encode this as:
let harmonic : compiled_fn =
compile {
name ="harmonic";
inputs = ["n"];
body = Sum("i", Num 1.0, Var "n", Div(Num 1.0, Var "i"));
}Your function gets compiled to native code using LLVM. You can then call 'harmonic' like this:
run harmonic [10.0]Don't use this compiler in a space vehicle.
Do use it to learn about LLVM.
Cheers,
Alex