Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Outlet is a simple Lisp-like programming language

branch: master
Octocat-spinner-32 backends get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 bin add -o flag to control optimizations, recompile without arg count che… May 07, 2012
Octocat-spinner-32 cps-research get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 docs regenerate compiler February 20, 2012
Octocat-spinner-32 examples add ~ for calling async function sync style, add examples May 21, 2012
Octocat-spinner-32 read update previous compiler with bugfixes/tweaks so it can compile new r… February 10, 2012
Octocat-spinner-32 tests get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 web update web repl April 08, 2012
Octocat-spinner-32 .gitignore integrate CPS into compiler May 11, 2012
Octocat-spinner-32 LICENSE relicense as 2-clause BSD April 20, 2012
Octocat-spinner-32 Makefile integrate CPS into compiler May 11, 2012
Octocat-spinner-32 NOTES get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 README.rst Update README.rst November 15, 2012
Octocat-spinner-32 ast.js get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 ast.ol debugging mode: verify argument count May 07, 2012
Octocat-spinner-32 compiler.js get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 compiler.ol get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 cps.js get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 cps.ol add ~ for calling async function sync style, add examples May 21, 2012
Octocat-spinner-32 make.js add -o flag to control optimizations, recompile without arg count che… May 07, 2012
Octocat-spinner-32 reader.js get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 reader.ol debugging mode: verify argument count May 07, 2012
Octocat-spinner-32 runtime-defs.ol integrate CPS into compiler May 11, 2012
Octocat-spinner-32 runtime.js get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 runtime.ol get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 test.js get compiler back into a working state, isolate CPS research November 15, 2012
Octocat-spinner-32 test.ol optimize `begin` May 14, 2012
README.rst

Outlet is a programming language. It is Lisp-like in nature and compiles to javascript (lua support is in the works).

See http://jlongster.com/2012/01/04/outlet-my-lisp-to-javascript-experiment.html.

Features

  • Object literals: {:one 1 :two 2}, [1 2 3 4 5]
  • A pretty printer: pp
  • Tail-recursive named lets:
(let loop ()
  (if (eq? (read-input) 'quit)
    (loop)))
  • Expansion Passing Style and define-macro style macros
  • Javascript code generator
  • Several other things, it's hackable!

Current Status

Outlet is no longer being actively hacked on. It is used to test out new ideas here and there, but it is not actively maintained.

I plan on writing a "post-mortem" of my experience, though this isn't necessarily dead, just frozen. I'll most likely come back and hack on cool ideas. It's just not something you should use, unless you want to play with compilers.

Example

(define foo 5)

(define (bar x)
  (+ x 1))

(define (me)
    (+ x 1))

(define (buz x y)
  (let ((z 5))
    (+ x y z)))

(define (fib n)
  (if (= n 0)
      n
      (+ n (fib (- n 1)))))

(define obj {:foo 1 :bar 2})       ; maps
(define vec [1 2 3 4])             ; vectors

(define (baz one two . three)      ; rest parameters
  (pp three))

(baz "a" "b" "c" "d" "e" "f")

(pp (eval_outlet '(baz 1 2 3 4)))  ; eval

(define (print-n n)
  (cond
   ((> n 0) (display "positive"))
   ((< n 0) (display "negative"))
   ((= n 0) (display "0"))
   (else (display "wait, what?")))) ; cond

(define-macro (when cond . body)    ; macros
  `(if ,cond
       (begin
         ,@body)))

Notes

The compiler is stable and a full runtime is available (see runtime.ol). It is written 100% in Outlet.

I was working on a virtual machine to run Outlet code that is compiled to special assembly instructions. It works great, but it is slow. The project is outlet-machine: https://github.com/jlongster/outlet-machine.

Using

To get started:

 # Download Outlet and add the `bin` directory to the path
 git clone git@github.com:jlongster/outlet.git
 export PATH="`pwd`/bin:$PATH"

 # Compile a file (saves it to file.js, the original filename with a js ext)
 ol file.ol

 # Compile a file and print to stdout
 ol -c file.ol

 # Evalute an expression
 ol -e '(define a 4)'

# Compile an expression and print to stdout
 ol -c -e '(define a 4)'

To use the javascript API:

var compiler = require('./compiler');
var js = require('./backends/js');
compiler.compile('(define foo 5)', js()); // returns javascript source

See the tests in tests for examples.

If you want to work on the compiler, Outlet comes with a Makefile. To compile your changes and run all tests:

make         # Compile the compiler with itself
make BOOT=1  # Compile the compiler with the last known working version
make test    # Run tests
Something went wrong with that request. Please try again.