Skip to content

Kaleidoscope implementation following along with LLVM's JIT language tutorial.

License

Notifications You must be signed in to change notification settings

0xekez/llvm-kaleidoscope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

============
Kaleidoscope
============

This closely follows LLVM's kaleidoscope and building a JIT
tutorials. It only makes a deviation from their tutorials in a couple
places:

- This modifies the kaleidoscope code to work with a JIT compiler
  using ORCv2.
- This includes a JIT compiler using ORCv2 following along with LLVM's
  tutorials on building one.
- This adds a couple comments and other notes for my own personal
  reference.

I have gotten in touch with the LLVM folks and they are working on
getting the kaleidoscope tutorial to play nice with ORCv2 but until
then this might serve as a nice reference to people interested in
using kaleidoscope with the newer JIT compiler.

You can find the tutorial on building kaleidoscope below. I'm quite
liking it so far:

https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index.html

Building & Running
------------------

If you'd like to build this repo you'll need a LLVM and Clang version
8 or greater. On MAC you can install LLVM with Homebew. Once you have
those installed, go ahead and run this command:

clang++ -g kaleidoscope_baseline.cpp `llvm-config --cxxflags --ldflags
--system-libs --libs all` -O3 -o kaleidoscope

Start the repl by running `./kaleidoscope` and try your first program:

ready> def fib(n) if (n < 2) then n else fib(n - 1) + fib(n - 2);
Read function definition.
ready> fib(40);
Evaluated to 102334155.000000


The language is still pretty light on features, but I'd like to add
some more to it. That will start out with work on the JIT compiler and
then I'd like to use the visitor pattern under the hood and add some
support for non-repl interaction.

About

Kaleidoscope implementation following along with LLVM's JIT language tutorial.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages