1. Shawn Hyam
  2. blub


Clone wiki

blub / Home


This is yet another project to create a new programming language. The idea is to start with a somewhat-compliant Scheme interpreter, and add JIT compiling support for that code which can be strongly-typed at runtime (using LLVM). We won't get overly worried about RxRS support, because the plan is to make some pretty major deviations from Scheme; the world has plenty of excellent Scheme implementations.

A major objective of the system is to attempt to combine the best of both worlds -- efficient execution when we can prove facts about the system (such as the types of values), but the ability to run even when these facts cannot be proven.

Basic Operation

First up, there is going to have to be some pretty major reorganization going on. We want to have the interpreter evaluate bytecodes that let us implement delimited continuations without doing a double-CPS conversion, but we also want to dynamically compile low-level bits of code from the AST in the current execution environment.

Thinking off the top of my head, the basic structure would be something like:

type ast =
    A_lit of sval
  | A_seq of ast array
  | A_cnd of ast * ast * ast

and bytecode =
    B_lit of sval
  | B_test of bytecode * bytecode
  | B_ast of ast
  | B_jit of llvalue 

let rec metaeval env ast =
  let code = try
    llvm_compile env ast  (* will reduce the entire AST below this point *)
  with Jit_failed ->
    bytecode_compile env ast  (* reduces one level of the AST only *)
  eval env code

and bytecode_compile env ast =
  assert false

and eval env = function
    B_jit code -> invoke_llvm env code
  | B_ast ast -> metaeval env ast
  | B_lit lit -> (* whatever *)



  1. Walking Skeleton

Deviations from Scheme

Interesting Papers