CoffeeScript

CoffeeScript is a little language that compiles into JavaScript. Think of it as JavaScript's less ostentatious kid brother — the same genes, roughly the same height, but a different sense of style. Apart from a handful of bonus goodies, statements in CoffeeScript correspond one-to-one with their equivalent in JavaScript, it's just another way of saying it.

Disclaimer: CoffeeScript is just for fun and seriously alpha. I'm sure that there are still plenty of holes in the lexer and leaks in the syntax. There is no guarantee, explicit or implied, of its suitability for any purpose. That said, it compiles into clean JavaScript (the good parts) that can use existing JavaScript libraries seamlessly, and passes through JSLint without warnings. The compiled output is quite readable — pretty-printed, with comments preserved intact.

Latest Version: 0.2.2

Table of Contents

Mini Overview
Installation and Usage
Significant Whitespace
Functions and Invocation
Assignment
Objects and Arrays
Lexical Scoping and Variable Safety
Conditionals, Ternaries, and Conditional Assignment
The Existence Operator
Aliases
Splats...
Arguments are Arrays
While Loops
Comprehensions (Arrays, Objects, and Ranges)
Array Slicing and Splicing with Ranges
Everything is an Expression
Inheritance, and Calling Super from a Subclass
Blocks
Embedded JavaScript
Switch/When/Else
Try/Catch/Finally
Multiline Strings
Resources
Contributing
Change Log

Mini Overview

CoffeeScript on the left, compiled JavaScript output on the right.

# Assignment:
number: 42
opposite_day: true

# Conditions:
number: -42 if opposite_day

# Functions:
square: x => x * x

# Arrays:
list: [1, 2, 3, 4, 5]

# Objects:
math: {
  root:   Math.sqrt
  square: square
  cube:   x => x * square(x)
}

# Splats:
race: winner, runners... =>
  print(winner, runners)

# Existence:
alert("I knew it!") if elvis?

# Array comprehensions:
cubed_list: math.cube(num) for num in list
var __a, __b, __c, cubed_list, list, math, num, number, opposite_day, race, square;
// Assignment:
number = 42;
opposite_day = true;
// Conditions:
if (opposite_day) {
  number = -42;
}
// Functions:
square = function square(x) {
  return x * x;
};
// Arrays:
list = [1, 2, 3, 4, 5];
// Objects:
math = {
  root: Math.sqrt,
  square: square,
  cube: function cube(x) {
    return x * square(x);
  }
};
// Splats:
race = function race(winner) {
  var runners;
  runners = Array.prototype.slice.call(arguments, 1);
  return print(winner, runners);
};
// Existence:
if ((typeof elvis !== "undefined" && elvis !== null)) {
  alert("I knew it!");
}
// Array comprehensions:
cubed_list = (function() {
  __c = []; __a = list;
  for (__b=0; __b<__a.length; __b++) {
    num = __a[__b];
    __c.push(math.cube(num));
  }
  return __c;
})();

For a longer CoffeeScript example, check out Underscore.coffee, a port of Underscore.js to CoffeeScript, which, when compiled, can pass the complete Underscore test suite. Or, clone the source and take a look in the examples folder.

Installation and Usage

The CoffeeScript compiler is written in pure Ruby, and is available as a Ruby Gem.

gem install coffee-script

Installing the gem provides the coffee command, which can be used to compile CoffeeScript .coffee files into JavaScript, as well as debug them. In conjunction with Narwhal, the coffee command also provides direct evaluation and an interactive REPL. When compiling to JavaScript, coffee writes the output as .js files in the same directory by default, but output can be customized with the following options:

-i, --interactive Launch an interactive CoffeeScript session. Requires Narwhal.
-r, --run Compile and execute scripts without saving the intermediate JavaScript. Requires Narwhal.
-o, --output [DIR] Write out all compiled JavaScript files into the specified directory.
-w, --watch Watch the modification times of the coffee-scripts, recompiling as soon as a change occurs.
-p, --print Instead of writing out the JavaScript as a file, print it directly to stdout.
-l, --lint If the jsl (JavaScript Lint) command is installed, use it to check the compilation of a CoffeeScript file. (Handy in conjunction with --watch)
-e, --eval Compile and print a little snippet of CoffeeScript directly from the command line (or from stdin). For example:
coffee -e "square: x => x * x"
-t, --tokens Instead of parsing the CoffeeScript, just lex it, and print out the token stream: [:IDENTIFIER, "square"], [":", ":"], [:PARAM, "x"] ...
-v, --verbose As the JavaScript is being generated, print out every step of code generation, including lexical scope and the node in the AST.
-n, --no-wrap Compile the JavaScript without the top-level function safety wrapper or var declarations, for situations where you want to add every variable to global scope.
--install-bundle Install the TextMate bundle for CoffeeScript syntax highlighting.

Examples:

coffee path/to/script.coffee
coffee --interactive
coffee --watch --lint experimental.coffee
coffee --print app/scripts/*.coffee > concatenation.js

Language Reference

This reference is structured so that it can be read from top to bottom, if you like. Later sections use ideas and syntax previously introduced. Familiarity with JavaScript is assumed. In all of the following examples, the source CoffeeScript is provided on the left, and the direct compilation into JavaScript is on the right.

Significant Whitespace CoffeeScript uses Python-style significant whitespace: You don't need to use semicolons ; to terminate expressions, ending the line will do just as well. Semicolons can still be used to fit multiple expressions onto a single line. Instead of using curly braces { } to delimit blocks of code (like functions, if-statements, switch, and try/catch), use indentation.

You can use newlines to break up your expression into smaller pieces, as long as CoffeeScript can tell that the line hasn't finished (similar to how Ruby handles it). For example, if the line ends in an operator, dot, or keyword.

Functions and Invocation Functions are defined by a list of parameters, an arrow, and the function body. The empty function looks like this: =>. All functions in CoffeeScript are named, for the benefit of debug messages.

square: x => x * x
cube:   x => square(x) * x
var cube, square;
square = function square(x) {
  return x * x;
};
cube = function cube(x) {
  return square(x) * x;
};

Assignment Use a colon : to assign, as in JSON. Equal signs are only needed for mathy things.

greeting: "Hello CoffeeScript"
difficulty: 0.5
var difficulty, greeting;
greeting = "Hello CoffeeScript";
difficulty = 0.5;

Declarations of new variables are pushed up to the top of the nearest lexical scope, so that assignment may always be performed within expressions.

Objects and Arrays Object and Array literals look very similar to their JavaScript cousins. When you spread out each assignment on a separate line, the commas are optional. In this way, assigning object properties looks the same as assigning local variables, and can be moved around freely. You can mix and match the two styles.

song: ["do", "re", "mi", "fa", "so"]

ages: {
  max: 10
  ida: 9
  tim: 11
}

matrix: [
  1, 0, 1
  0, 0, 1
  1, 1, 0
]
var ages, matrix, song;
song = ["do", "re", "mi", "fa", "so"];
ages = {
  max: 10,
  ida: 9,
  tim: 11
};
matrix = [1, 0, 1, 0, 0, 1, 1, 1, 0];

Lexical Scoping and Variable Safety The CoffeeScript compiler takes care to make sure that all of your variables are properly declared within lexical scope — you never need to write var yourself.

num: 1
change_numbers: =>
  new_num: -1
  num: 10
new_num: change_numbers()
var change_numbers, new_num, num;
num = 1;
change_numbers = function change_numbers() {
  var new_num;
  new_num = -1;
  return num = 10;
};
new_num = change_numbers();

Notice how the all of the variable declarations have been pushed up to the top of the closest scope, the first time they appear. num is not redeclared within the inner function, because it's already in scope; the new_num within the function, on the other hand, should not be able to change the value of the external variable of the same name, and therefore has a declaration of its own.

Although suppressed within this documentation for clarity, all CoffeeScript output is wrapped in an anonymous function: (function(){ ... })(); This safety wrapper, combined with the automatic generation of the var keyword, make it exceedingly difficult to pollute the global namespace by accident. If you'd like to create global variables, attach them as properties on window, or on the exports object in CommonJS.

Conditionals, Ternaries, and Conditional Assignment If/else statements can be written without the use of parentheses and curly brackets. As with functions and other block expressions, multi-line conditionals are delimited by indentation. There's also a handy postfix form, with the if or unless at the end.

CoffeeScript will compile if statements using the ternary operator when possible, to make it easier to use the result as an expression.

mood: greatly_improved if singing

if happy and knows_it
  claps_hands()
  cha_cha_cha()

date: if friday then sue else jill

expensive ||= do_the_math()
var date, mood;
if (singing) {
  mood = greatly_improved;
}
if (happy && knows_it) {
  claps_hands();
  cha_cha_cha();
}
date = friday ? sue : jill;
expensive = expensive || do_the_math();

The conditional assignment operators are included: ||=, which only assigns a value to a variable if the variable's current value is falsy, and &&=, which only replaces the value of truthy variables.

The Existence Operator It's a little difficult to check for the existence of a variable in JavaScript. if (variable) ... comes close, but fails for zero, the empty string, and false. The existence operator ? returns true unless a variable is null or undefined, which makes it analogous to Ruby's nil?

solipsism: true if mind? and not world?
var solipsism;
if ((typeof mind !== "undefined" && mind !== null) && !(typeof world !== "undefined" && world !== null)) {
  solipsism = true;
}

Aliases Because the == operator frequently causes undesirable coercion, is intransitive, and has a different meaning than in other languages, CoffeeScript compiles == into ===, and != into !==. In addition, is compiles into ===, and isnt into !==.

You can use not as an alias for !.

For logic, and compiles to &&, and or into ||.

Instead of a newline or semicolon, then can be used to separate conditions from expressions, in while, if/else, and switch/when statements.

As in YAML, on and yes are the same as boolean true, while off and no are boolean false.

For single-line statements, unless can be used as the inverse of if.

launch() if ignition is on

volume: 10 if band isnt spinal_tap

let_the_wild_rumpus_begin() unless answer is no

if car.speed < speed_limit then accelerate()
var volume;
if (ignition === true) {
  launch();
}
if (band !== spinal_tap) {
  volume = 10;
}
if (!(answer === false)) {
  let_the_wild_rumpus_begin();
}
car.speed < speed_limit ? accelerate() : null;

Splats... The JavaScript arguments object is a useful way to work with functions that accept variable numbers of arguments. CoffeeScript provides splats ..., both for function definition as well as invocation, making variable arguments a little bit more palatable.

gold: silver: the_field: "unknown"

medalists: first, second, rest... =>
  gold:       first
  silver:     second
  the_field:  rest

contenders: [
  "Michael Phelps"
  "Liu Xiang"
  "Yao Ming"
  "Allyson Felix"
  "Shawn Johnson"
  "Roman Sebrle"
  "Guo Jingjing"
  "Tyson Gay"
  "Asafa Powell"
  "Usain Bolt"
]

medalists(contenders...)

alert("Gold: " + gold)
alert("Silver: " + silver)
alert("The Field: " + the_field)
var contenders, gold, medalists, silver, the_field;
gold = silver = the_field = "unknown";
medalists = function medalists(first, second) {
  var rest;
  rest = Array.prototype.slice.call(arguments, 2);
  gold = first;
  silver = second;
  return the_field = rest;
};
contenders = ["Michael Phelps", "Liu Xiang", "Yao Ming", "Allyson Felix", "Shawn Johnson", "Roman Sebrle", "Guo Jingjing", "Tyson Gay", "Asafa Powell", "Usain Bolt"];
medalists.apply(this, contenders);
alert("Gold: " + gold);
alert("Silver: " + silver);
alert("The Field: " + the_field);

Arguments are Arrays If you reference the arguments object directly, it will be converted into a real Array, making all of the Array methods available.

backwards: =>
  alert(arguments.reverse())

backwards("stairway", "to", "heaven")
var backwards;
backwards = function backwards() {
  return alert(Array.prototype.slice.call(arguments, 0).reverse());
};
backwards("stairway", "to", "heaven");

While Loops The only low-level loop that CoffeeScript provides is the while loop.

while demand > supply
  sell()
  restock()

while supply > demand then buy()
while (demand > supply) {
  sell();
  restock();
}
while (supply > demand) {
  buy();
}

Other JavaScript loops, such as for loops and do-while loops can be mimicked by variations on while, but the hope is that you won't need to do that with CoffeeScript, either because you're using each (forEach) style iterators, or...

Comprehensions (Arrays, Objects, and Ranges) For your looping needs, CoffeeScript provides array comprehensions similar to Python's. They replace (and compile into) for loops, with optional guard clauses and the value of the current array index. Unlike for loops, array comprehensions are expressions, and can be returned and assigned. They should be able to handle most places where you otherwise would use a loop, each/forEach, map, or select/filter.

# Eat lunch.
lunch: eat(food) for food in ['toast', 'cheese', 'wine']

# Naive collision detection.
for roid in asteroids
  for roid2 in asteroids when roid isnt roid2
    roid.explode() if roid.overlaps(roid2)
var __a, __b, __c, __d, __e, __f, __g, food, lunch, roid, roid2;
// Eat lunch.
lunch = (function() {
  __c = []; __a = ['toast', 'cheese', 'wine'];
  for (__b=0; __b<__a.length; __b++) {
    food = __a[__b];
    __c.push(eat(food));
  }
  return __c;
})();
// Naive collision detection.
__d = asteroids;
for (__e=0; __e<__d.length; __e++) {
  roid = __d[__e];
  __f = asteroids;
  for (__g=0; __g<__f.length; __g++) {
    roid2 = __f[__g];
    if (roid !== roid2) {
      if (roid.overlaps(roid2)) {
        roid.explode();
      }
    }
  }
}

If you know the start and end of your loop, or would like to step through in fixed-size increments, you can use a range to specify the start and end of your comprehension. (The long line-breaking "for" definitions in the compiled JS below allow ranges to count downwards, as well as upwards).

countdown: num for num in [10..1]

egg_delivery: =>
  for i in [0...eggs.length] by 12
    dozen_eggs: eggs[i...i+12]
    deliver(new egg_carton(dozen))
var __a, __b, __c, __d, __e, countdown, egg_delivery, num;
countdown = (function() {
  __b = []; __d = 10; __e = 1;
  for (__c=0, num=__d; (__d <= __e ? num <= __e : num >= __e); (__d <= __e ? num += 1 : num -= 1), __c++) {
    __b.push(num);
  }
  return __b;
})();
egg_delivery = function egg_delivery() {
  var __f, __g, __h, __i, __j, dozen_eggs, i;
  __g = []; __i = 0; __j = eggs.length;
  for (__h=0, i=__i; (__i <= __j ? i < __j : i > __j); (__i <= __j ? i += 12 : i -= 12), __h++) {
    __g.push((function() {
      dozen_eggs = eggs.slice(i, i + 12);
      return deliver(new egg_carton(dozen));
    })());
  }
  return __g;
};

Comprehensions can also be used to iterate over the keys and values in an object. Use ino to signal comprehension over an object instead of an array.

years_old: {max: 10, ida: 9, tim: 11}

ages: child + " is " + age for child, age ino years_old
var __a, __b, age, ages, child, years_old;
years_old = {
  max: 10,
  ida: 9,
  tim: 11
};
ages = (function() {
  __b = []; __a = years_old;
  for (child in __a) {
    age = __a[child];
    if (__a.hasOwnProperty(child)) {
      __b.push(child + " is " + age);
    }
  }
  return __b;
})();

Array Slicing and Splicing with Ranges CoffeeScript borrows Ruby's range syntax for extracting slices of arrays. With two dots (3..5), the range is inclusive: the first argument is the index of the first element in the slice, and the second is the index of the last one. Three dots signify a range that excludes the end.

numbers: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

three_to_six: numbers[3..6]

numbers_copy: numbers[0...numbers.length]

var numbers, numbers_copy, three_to_six;
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
three_to_six = numbers.slice(3, 6 + 1);
numbers_copy = numbers.slice(0, numbers.length);

The same syntax can be used with assignment to replace a segment of an array with new values (to splice it).

numbers: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

numbers[3..6]: [-3, -4, -5, -6]


var numbers;
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
numbers.splice.apply(numbers, [3, 6 - 3 + 1].concat([-3, -4, -5, -6]));

Everything is an Expression (at least, as much as possible) You might have noticed how even though we don't add return statements to CoffeeScript functions, they nonetheless return their final value. The CoffeeScript compiler tries to make sure that all statements in the language can be used as expressions. Watch how the return gets pushed down into each possible branch of execution, in the function below.

grade: student =>
  if student.excellent_work
    "A+"
  else if student.okay_stuff
    if student.tried_hard then "B" else "B-"
  else
    "C"

eldest: if 24 > 21 then "Liz" else "Ike"
var eldest, grade;
grade = function grade(student) {
  if (student.excellent_work) {
    return "A+";
  } else if (student.okay_stuff) {
    return student.tried_hard ? "B" : "B-";
  } else {
    return "C";
  }
};
eldest = 24 > 21 ? "Liz" : "Ike";

Because variable declarations occur at the top of scope, assignment can be used within expressions, even for variables that haven't been seen before:

six: (one: 1) + (two: 2) + (three: 3)
var one, six, three, two;
six = (one = 1) + (two = 2) + (three = 3);

Things that would otherwise be statements in JavaScript, when used as part of an expression in CoffeeScript, are converted into expressions by wrapping them in a closure. This lets you do useful things, like assign the result of a comprehension to a variable:

# The first ten global properties.

globals: (name for property, name in window)[0...10]
var __a, __b, globals, name, property;
// The first ten global properties.
globals = ((function() {
  __b = []; __a = window;
  for (name=0; name<__a.length; name++) {
    property = __a[name];
    __b.push(name);
  }
  return __b;
})()).slice(0, 10);

As well as silly things, like passing a try/catch statement directly into a function call:

alert(
  try
    nonexistent / undefined
  catch error
    "Caught an error: " + error
)
alert((function() {
  try {
    return nonexistent / undefined;
  } catch (error) {
    return "Caught an error: " + error;
  }
})());

Inheritance, and Calling Super from a Subclass JavaScript's prototypal inheritance has always been a bit of a brain-bender, with a whole family tree of libraries that provide a cleaner syntax for classical inheritance on top of JavaScript's prototypes: Base2, Prototype.js, JS.Class, etc. The libraries provide syntactic sugar, but the built-in inheritance would be completely usable if it weren't for a couple of small exceptions: it's awkward to call super (the prototype object's implementation of the current function), and it's awkward to correctly set the prototype chain. CoffeeScript provides extends to help with prototype setup, and converts super() calls into calls against the immediate ancestor's method of the same name.

Animal: =>
Animal.prototype.move: meters =>
  alert(this.name + " moved " + meters + "m.")

Snake: name => this.name: name
Snake extends Animal
Snake.prototype.move: =>
  alert("Slithering...")
  super(5)

Horse: name => this.name: name
Horse extends Animal
Horse.prototype.move: =>
  alert("Galloping...")
  super(45)

sam: new Snake("Sammy the Python")
tom: new Horse("Tommy the Palomino")

sam.move()
tom.move()




var Animal, Horse, Snake, __a, __b, sam, tom;
Animal = function Animal() {
};
Animal.prototype.move = function move(meters) {
  return alert(this.name + " moved " + meters + "m.");
};
Snake = function Snake(name) {
  var __a;
  __a = this.name = name;
  return Snake === this.constructor ? this : __a;
};
__a = function(){};
__a.prototype = Animal.prototype;
Snake.__superClass__ = Animal.prototype;
Snake.prototype = new __a();
Snake.prototype.constructor = Snake;
Snake.prototype.move = function move() {
  alert("Slithering...");
  return Snake.__superClass__.move.call(this, 5);
};
Horse = function Horse(name) {
  var __b;
  __b = this.name = name;
  return Horse === this.constructor ? this : __b;
};
__b = function(){};
__b.prototype = Animal.prototype;
Horse.__superClass__ = Animal.prototype;
Horse.prototype = new __b();
Horse.prototype.constructor = Horse;
Horse.prototype.move = function move() {
  alert("Galloping...");
  return Horse.__superClass__.move.call(this, 45);
};
sam = new Snake("Sammy the Python");
tom = new Horse("Tommy the Palomino");
sam.move();
tom.move();

Blocks Many common looping functions (in Prototype, jQuery, and Underscore, for example) take a single function as their final argument. To make final functions easier to pass, CoffeeScript includes block syntax, so you don't have to close the parentheses on the other side.

$('table.list').each() table =>
  $('tr.account', table).each() row =>
    row.show()
    row.highlight()
$('table.list').each(function(table) {
  return $('tr.account', table).each(function(row) {
    row.show();
    return row.highlight();
  });
});

Embedded JavaScript If you ever need to interpolate literal JavaScript snippets, you can use backticks to pass JavaScript straight through.

hi: `function() {
  return [document.title, "Hello JavaScript"].join(": ");
}`


var hi;
hi = function() {
return [document.title, "Hello JavaScript"].join(": ");
};

Switch/When/Else Switch statements in JavaScript are rather broken. You can only do comparisons based on string equality, and need to remember to break at the end of every case statement to avoid accidentally falling through to the default case. CoffeeScript compiles switch statements into JavaScript if-else chains, allowing you to compare any object (via ===), preventing fall-through, and resulting in a returnable, assignable expression. The format is: switch condition, when clauses, else the default case.

switch day
  when "Tuesday"   then eat_breakfast()
  when "Wednesday" then go_to_the_park()
  when "Saturday"
    if day is bingo_day
      go_to_bingo()
      go_dancing()
  when "Sunday"    then go_to_church()
  else go_to_work()
if (day === "Tuesday") {
  eat_breakfast();
} else if (day === "Wednesday") {
  go_to_the_park();
} else if (day === "Saturday") {
  if (day === bingo_day) {
    go_to_bingo();
    go_dancing();
  }
} else if (day === "Sunday") {
  go_to_church();
} else {
  go_to_work();
}

Try/Catch/Finally Try/catch statements are just about the same as JavaScript (although they work as expressions).

try
  all_hell_breaks_loose()
  cats_and_dogs_living_together()
catch error
  print(error)
finally
  clean_up()
try {
  all_hell_breaks_loose();
  cats_and_dogs_living_together();
} catch (error) {
  print(error);
} finally {
  clean_up();
}

Multiline Strings Multiline strings are allowed in CoffeeScript.

moby_dick: "Call me Ishmael. Some years ago --
never mind how long precisely -- having little
or no money in my purse, and nothing particular
to interest me on shore, I thought I would sail
about a little and see the watery part of the
world..."


var moby_dick;
moby_dick = "Call me Ishmael. Some years ago -- \
never mind how long precisely -- having little \
or no money in my purse, and nothing particular \
to interest me on shore, I thought I would sail \
about a little and see the watery part of the \
world...";

Resources

Contributing

Here's a wish list of things that would be wonderful to have in CoffeeScript:

Change Log

0.2.2 The "splat" symbol has been changed from a prefix asterisk *, to a postfix ellipsis .... Added JavaScript's in operator, empty return statements, and empty while loops. Constructor functions that start with capital letters now include a safety check to make sure that the new instance of the object is returned. The extends keyword now functions identically to goog.inherits in Google's Closure Library.

0.2.1 Arguments objects are now converted into real arrays when referenced.

0.2.0 Major release. Significant whitespace. Better statement-to-expression conversion. Splats. Splice literals. Object comprehensions. Blocks. The existence operator. Many thanks to all the folks who posted issues, with special thanks to Liam O'Connor-Davis for whitespace and expression help.

0.1.6 Bugfix for running coffee --interactive and --run from outside of the CoffeeScript directory. Bugfix for nested function/if-statements.

0.1.5 Array slice literals and array comprehensions can now both take Ruby-style ranges to specify the start and end. JavaScript variable declaration is now pushed up to the top of the scope, making all assignment statements into expressions. You can use \ to escape newlines. The coffee-script command is now called coffee.

0.1.4 The official CoffeeScript extension is now .coffee instead of .cs, which properly belongs to C#. Due to popular demand, you can now also use = to assign. Unlike JavaScript, = can also be used within object literals, interchangeably with :. Made a grammatical fix for chained function calls like func(1)(2)(3)(4). Inheritance and super no longer use __proto__, so they should be IE-compatible now.

0.1.3 The coffee command now includes --interactive, which launches an interactive CoffeeScript session, and --run, which directly compiles and executes a script. Both options depend on a working installation of Narwhal. The aint keyword has been replaced by isnt, which goes together a little smoother with is. Quoted strings are now allowed as identifiers within object literals: eg. {"5+5": 10}. All assignment operators now use a colon: +:, -:, *:, etc.

0.1.2 Fixed a bug with calling super() through more than one level of inheritance, with the re-addition of the extends keyword. Added experimental Narwhal support (as a Tusk package), contributed by Tom Robinson, including bin/cs as a CoffeeScript REPL and interpreter. New --no-wrap option to suppress the safety function wrapper.

0.1.1 Added instanceof and typeof as operators.

0.1.0 Initial CoffeeScript release.