Irken is a statically typed variant of Scheme. Or a lisp-like variant of ML.
C Scheme Python HTML LLVM GAP Other
Permalink
Failed to load latest commit information.
demo
doom
include
lang
lib comments on deprecated status. Feb 23, 2017
notes explain why no recursive types. Aug 10, 2016
old git-svn-id: file:///Users/rushing/svn/pxll@2 6687424e-f796-406d-b1dd-… Dec 2, 2008
parse generate more compact tables using defmacro Mar 3, 2013
repl adding the beginnings of an interactive irken interpreter. 99% @rushing Feb 17, 2017
self
tests
util
vm
.gitignore ignore [some] generated files. Feb 23, 2017
LICENSE.txt
Makefile
README.md
irken.el
irken.html
irken.svg
lang.html steal a little style from github Mar 7, 2012

README.md

The Irken Compiler

irken logo

Irken is a statically-typed, simplified variant of Scheme. Or... a lisp-like variant of ML, depending on your point of view. If you're not familiar with either family of languages, Irken is a strongly typed, compiled language with a lisp-like syntax extensible with macros. It uses type inference along with a powerful type system to give you the speed of a compiled language with high-level data types and a higher degree of safety than languages like C/C++.

News:

20170217: Merged the LLVM backend, plus many new fixes & features.

Introduction/Tutorial:

http://dark.nightmare.com/rushing/irken/irken/lang.html

The best way to get familiar with the language is to read the source code in the 'self' directory, and browse over the files in "tests".

Bootstrap:

Irken is now written in itself, so you need to bootstrap it. You can do this via the python script, or manually. [see https://github.com/samrushing/irken-compiler/wiki/bootstrapping-manually]

Just run the script "util/bootstrap.py":

$ python util/bootstrap.py
[the default compiler is 'clang', to use gcc:
  $ CC=gcc python util/bootstrap.py ]

Which does the following:

  1. compile the distributed version of self/compile.c
  2. this binary will be used to recompile the compiler.
  3. that binary will recompile the compiler again.
  4. the output from steps 2 and 3 are compared, they should be identical.

Note: It is not possible to compile with optimization off, because this disables the tail call optimization that Irken relies on - otherwise the stack will overflow instantly.

At this time (early 2013), clang builds -O3 in about 30 seconds. gcc 4.8 seems to do a better of job of optimizing than clang 3.2, but takes about twice as long to compile.

Installation:

$ python util/install.py

This will install support files into /usr/local/lib/irken and the binary as /usr/local/bin/irken. If you want to use a different prefix (like /usr), edit util/install.py and self/context.scm, and rebuild self/compile before installing:

$ self/compile self/compile.scm

Usage:

Here's a sample - build the toy VM and test it out:

$ cd vm
$ irken vm.scm
$ ./vm tests/t11.byc

The VM executes some bytecode that runs the 'tak' benchmark 20 times.

You might want to try looking at and understanding the 'verbose' output from the compiler, using a relatively small example:

$ irken -v tests/t_while.scm

Irken will use the CC and CFLAGS environment variables when compiling the C output. You may try out another compiler like this:

$ CC="gcc" CFLAGS="-std=c99 -O2 -I." irken ...

LLVM Backend:

To use the LLVM backend:

$ irken vm.scm -llvm

Note: the llvm backend currently assumes that -flto can be fed to clang, this works on OS X, but seems to fail on FreeBSD & Linux. I think some kind of plugin is needed. You can remove -flto from flags.scm if necessary.