Giter Site home page Giter Site logo

adaminsky / kale-lang Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 93 KB

Basic language built for personal edification off the LLVM Kaleidoscope tutorial.

License: MIT License

CMake 2.29% C++ 97.71%
llvm programming-languages kaleidoscope cpp cmake

kale-lang's Introduction

Kale Lang

Badge

  • Based on the LLVM Kaleidoscope tutorial, but tried to use some good design principles I've learned from taking a compilers class.
  • Mostly just a fun project done to learn more about LLVM.

Building

mkdir build && cd build
cmake ..
make

This project depends on LLVM libraries, so just having clang is not enough to build.

Running

Execute ./Kale and then type in your program. Alternatively, pipe the text of the program into stdin like the following:

./Kale < fib.kl

An object file is output called output.o and the LLVM IR is dumped to stderr. To try running a program, pipe stderr into another file and then call clang on that. In the following example, I am using printd which is defined in the print_dyn.cc file and created as the shared library "libprint". To link with this library, do the following:

./Kale < fib.kl 2> fib.ir
clang -x ir fib.ir -L. -lprint

This assumes that you are executing the above commands in the build/ folder. Finally, to correctly run the program with the dynamic library, the LD_LIBRARY_PATH must be set to the directory where libprint.so is located which is probably the current build directory.

Another way that a Kale program can be used is by linking with a C/C++ program by using the output.o file as an input to a clang build.

kale-lang's People

Contributors

adaminsky avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.