Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

calc

Calc is a proof of concept to implement a simple arithmetic language interpreter with JIT compilation, using either LLVM or a more low-level JIT based on GNU Lightning.

A fun weekend project, if you ask me!

Install

You need LLVM and GNU Lightning installed. On Mac OSX:

$ brew install llvm

Unfortunately the version of Lightning in Homebrew is broken. Download and install lightning from its mirror git repository.

Now:

$ git clone git://github.com/txus/calc.git calc
$ cd calc
$ make

You get the calc executable.

Usage

Using the AST-walking interpreter:

$ ./calc "3 * (4 + 5)"

Using the LLVM JIT compiler:

$ ./calc --llvm "3 * (4 + 5)"

Using the lower-level, GNU-lightning based JIT compiler:

$ ./calc --jit "3 * (4 + 5)"

Syntax

It's just integers, these operators: + - * /, and parentheses for precedence.

Who's this

This was made by Josep M. Bach (Txus) under the MIT license. I'm @txustice on twitter (where you should probably follow me!).

About

Simple arithmetic language interpreter with JIT compilation, using LLVM.

Resources

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.