llvm-hs / llvm-hs-examples

Examples for Haskell bindings to LLVM
MIT License
70 stars 20 forks source link

add an example with JIT compilation of arithmetic/trigonometric expressions #8

Closed alpmestan closed 6 years ago

alpmestan commented 6 years ago

The whole thing is a little under 350 lines (including comments etc) so I thought this could be a nice addition to this repo. I'm planning to write a post about it as well.

Note that this requires my recent PR to llvm-hs for the JIT's external symbol resolver, so I'm using 5.1.2 as a bound assuming that will be the version number of the first release to include my patch. We can wait for it to be released before merging this PR if you want.

sdiehl commented 6 years ago

I don't believe we currently has llvm-hs-pretty in our stack.yaml yet. This may be causing the build to fail.

alpmestan commented 6 years ago

@sdiehl The llvm-hs bound is not going to work as-is until there's a 5.1.2 release either :) But at least there's the code, feel free to tweak it or ask for changes and merge it as you see fit.

sdiehl commented 6 years ago

Cool, I'll take a look at this evening and get the bounds sorted. Thanks!

sdiehl commented 6 years ago

Ok, version bounds are all sorted. Many thanks.

alpmestan commented 6 years ago

Thanks for taking care of that. Now on to wprking on fancier toy languages. Not sure those will fit the "small example" format implicitly required for this repo.

cocreature commented 6 years ago

@alpmestan We could at least put a link in the README to some repo.

sdiehl commented 6 years ago

Can create a new folder and throw a few modules in there. Should be fine for this repo.