Skip to content

onilabs/coffee-script

 
 

Repository files navigation

First cut at a Stratified CoffeeScript compiler.
================================================

- Compiles to StratifiedJS (http://onilabs.com/stratifiedjs)

- Supports the following constructs:

Stratified CoffeeScript  -->     StratifiedJS
-----------------------          ------------

waitfor                  -->     waitfor () {
  asyncFunc resume                 asyncFunc(resume)
                                 }

waitfor rv               -->     waitfor (rv) {
  asyncFunc resume                 asyncFunc(resume)
                                 }

waitfor                  -->     waitfor {
  foo a                            foo(a);
then                             }
  bar x                          and {
                                   bar(x);
                                 }

waitfor                  -->     waitfor {
  foo a                            foo(a);
else                             }
  bar x                          or {
                                   bar(x);
                                 }

try                      -->     try {
  foo a                            foo(a);
retract                          }
  cleanup a                      retract {
                                   cleanup(a);
                                 }

- You can use catch/retract/finally also directly after waitfor, e.g.:

waitfor                   -->   waitfor () {
  id = setTimeout resume,         var id = setTimeout(resume,1000);
         1000                   }
retract                         retract {
  cancelTimeout id                cancelTimeout(id);
                                }

- NOTE THE USE OF 'then' AND 'else' INSTEAD OF 'and'/'or'. Ideally we
  would like 'and'/'or' also in CoffeeScript, but they are kinda hard to
  parse, because CoffeeScript uses them for other stuff as well.



ORIGINAL README CONTENTS:
=========================

            {
         }   }   {
        {   {  }  }
         }   }{  {
        {  }{  }  }                    _____       __  __
       ( }{ }{  { )                   / ____|     / _|/ _|
     .- { { }  { }} -.               | |     ___ | |_| |_ ___  ___
    (  ( } { } { } }  )              | |    / _ \|  _|  _/ _ \/ _ \
    |`-..________ ..-'|              | |___| (_) | | | ||  __/  __/
    |                 |               \_____\___/|_| |_| \___|\___|
    |                 ;--.
    |                (__  \            _____           _       _
    |                 | )  )          / ____|         (_)     | |
    |                 |/  /          | (___   ___ _ __ _ _ __ | |_
    |                 (  /            \___ \ / __| '__| | '_ \| __|
    |                 |/              ____) | (__| |  | | |_) | |_
    |                 |              |_____/ \___|_|  |_| .__/ \__|
     `-.._________..-'                                  | |
                                                        |_|


  CoffeeScript is a little language that compiles into JavaScript.

  Install Node.js, and then the CoffeeScript compiler:
  sudo bin/cake install

  Or, if you have the Node Package Manager installed:
  npm install -g coffee-script
  (Leave off the -g if you don't wish to install globally.)

  Execute a script:
  coffee /path/to/script.coffee

  Compile a script:
  coffee -c /path/to/script.coffee

  For documentation, usage, and examples, see:
  http://coffeescript.org/

  To suggest a feature, report a bug, or general discussion:
  http://github.com/jashkenas/coffee-script/issues/

  If you'd like to chat, drop by #coffeescript on Freenode IRC,
  or on webchat.freenode.net.

  The source repository:
  git://github.com/jashkenas/coffee-script.git

  All contributors are listed here:
  http://github.com/jashkenas/coffee-script/contributors

Packages

No packages published

Languages

  • CoffeeScript 96.2%
  • JavaScript 3.1%
  • Ruby 0.7%