-
Notifications
You must be signed in to change notification settings - Fork 2
Toy compiler for OCaml Meetup
License
iskandr/ocaml_llvm
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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
About
Toy compiler for OCaml Meetup
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published