Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bumping to 0.1.3 ... here we go
  • Loading branch information
jashkenas committed Dec 25, 2009
1 parent e7e8e24 commit c4ba971
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 71 deletions.
4 changes: 2 additions & 2 deletions coffee-script.gemspec
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = 'coffee-script'
s.version = '0.1.2' # Keep version in sync with coffee-script.rb
s.date = '2009-12-24'
s.version = '0.1.3' # Keep version in sync with coffee-script.rb
s.date = '2009-12-25'

s.homepage = "http://jashkenas.github.com/coffee-script/"
s.summary = "The CoffeeScript Compiler"
Expand Down
39 changes: 34 additions & 5 deletions documentation/index.html.erb
Expand Up @@ -37,8 +37,6 @@
equivalent in JavaScript, it's just another way of saying it.
</p>

<!-- <%# code_for('intro') %>-->

<p>
<b>Disclaimer:</b>
CoffeeScript is just for fun and seriously alpha. I'm sure that there are still
Expand Down Expand Up @@ -95,14 +93,31 @@ gem install coffee-script</pre>
<p>
Installing the gem provides the <tt>coffee-script</tt> command, which can
be used to compile CoffeeScript <tt>.cs</tt> files into JavaScript, as
well as debug them. By default, <tt>coffee-script</tt> writes out the
JavaScript as <tt>.js</tt> files in the same directory, but output
well as debug them. In conjunction with
<a href="http://narwhaljs.org/">Narwhal</a>, the <tt>coffee-script</tt>
command also provides direct evaluation and an interactive REPL.
When compiling to JavaScript, <tt>coffee-script</tt> writes the output
as <tt>.js</tt> files in the same directory by default, but output
can be customized with the following options:
</p>

<table>
<tr>
<td width="25%"><code>-o, --output [DIR]</code></td>
<td width="25%"><code>-i, --interactive</code></td>
<td>
Launch an interactive CoffeeScript session.
Requires <a href="http://narwhaljs.org/">Narwhal</a>.
</td>
</tr>
<tr>
<td><code>-r, --run</code></td>
<td>
Compile and execute the CoffeeScripts without saving the intermediate
JavaScript. Requires <a href="http://narwhaljs.org/">Narwhal</a>.
</td>
</tr>
<tr>
<td><code>-o, --output [DIR]</code></td>
<td>
Write out all compiled JavaScript files into the specified directory.
</td>
Expand Down Expand Up @@ -427,6 +442,20 @@ coffee-script --print app/scripts/*.cs > concatenation.js</pre>
</ul>

<h2 id="change_log">Change Log</h2>

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

<p>
<b class="header" style="margin-top: 20px;">0.1.2</b>
Expand Down
20 changes: 10 additions & 10 deletions documentation/js/array_comprehensions.js
Expand Up @@ -2,18 +2,18 @@

// Eat lunch.
var lunch;
var a = ['toast', 'cheese', 'wine'];
var d = [];
for (var b=0, c=a.length; b<c; b++) {
var food = a[b];
d[b] = food.eat();
var __a = ['toast', 'cheese', 'wine'];
var __d = [];
for (var __b=0, __c=__a.length; __b<__c; __b++) {
var food = __a[__b];
__d[__b] = food.eat();
}
lunch = d;
lunch = __d;
// Zebra-stripe a table.
var e = table;
for (var f=0, g=e.length; f<g; f++) {
var row = e[f];
var i = f;
var __e = table;
for (var __f=0, __g=__e.length; __f<__g; __f++) {
var row = __e[__f];
var i = __f;
i % 2 === 0 ? highlight(row) : null;
}
})();
12 changes: 6 additions & 6 deletions documentation/js/overview.js
Expand Up @@ -23,11 +23,11 @@
};
// Array comprehensions:
var cubed_list;
var a = list;
var d = [];
for (var b=0, c=a.length; b<c; b++) {
var num = a[b];
d[b] = math.cube(num);
var __a = list;
var __d = [];
for (var __b=0, __c=__a.length; __b<__c; __b++) {
var num = __a[__b];
__d[__b] = math.cube(num);
}
cubed_list = d;
cubed_list = __d;
})();
121 changes: 75 additions & 46 deletions index.html
Expand Up @@ -23,8 +23,6 @@ <h1><sub style="font-size: 100px;">&#9749;</sub> CoffeeScript</h1>
equivalent in JavaScript, it's just another way of saying it.
</p>

<!-- -->

<p>
<b>Disclaimer:</b>
CoffeeScript is just for fun and seriously alpha. I'm sure that there are still
Expand Down Expand Up @@ -112,13 +110,13 @@ <h2 id="overview">Mini Overview</h2>
};
<span class="Comment"><span class="Comment">//</span> Array comprehensions:</span>
<span class="Storage">var</span> cubed_list;
<span class="Storage">var</span> a <span class="Keyword">=</span> list;
<span class="Storage">var</span> d <span class="Keyword">=</span> [];
<span class="Keyword">for</span> (<span class="Storage">var</span> b<span class="Keyword">=</span><span class="Number">0</span>, c<span class="Keyword">=</span>a.<span class="LibraryConstant">length</span>; b<span class="Keyword">&lt;</span>c; b<span class="Keyword">++</span>) {
<span class="Storage">var</span> num <span class="Keyword">=</span> a[b];
d[b] <span class="Keyword">=</span> math.cube(num);
<span class="Storage">var</span> __a <span class="Keyword">=</span> list;
<span class="Storage">var</span> __d <span class="Keyword">=</span> [];
<span class="Keyword">for</span> (<span class="Storage">var</span> __b<span class="Keyword">=</span><span class="Number">0</span>, __c<span class="Keyword">=</span>__a.<span class="LibraryConstant">length</span>; __b<span class="Keyword">&lt;</span>__c; __b<span class="Keyword">++</span>) {
<span class="Storage">var</span> num <span class="Keyword">=</span> __a[__b];
__d[__b] <span class="Keyword">=</span> math.cube(num);
}
cubed_list <span class="Keyword">=</span> d;
cubed_list <span class="Keyword">=</span> __d;
</pre><button onclick='javascript:
// Assignment:
var number = 42;
Expand All @@ -143,17 +141,17 @@ <h2 id="overview">Mini Overview</h2>
};
// Array comprehensions:
var cubed_list;
var a = list;
var d = [];
for (var b=0, c=a.length; b<c; b++) {
var num = a[b];
d[b] = math.cube(num);
var __a = list;
var __d = [];
for (var __b=0, __c=__a.length; __b<__c; __b++) {
var num = __a[__b];
__d[__b] = math.cube(num);
}
cubed_list = d;
cubed_list = __d;
;alert(cubed_list);'>run: cubed_list</button><br class='clear' /></div>

<h2 id="installation">Installation and Usage</h2>

<p>
The CoffeeScript compiler is written in pure Ruby, and is available
as a Ruby Gem.
Expand All @@ -165,14 +163,31 @@ <h2 id="installation">Installation and Usage</h2>
<p>
Installing the gem provides the <tt>coffee-script</tt> command, which can
be used to compile CoffeeScript <tt>.cs</tt> files into JavaScript, as
well as debug them. By default, <tt>coffee-script</tt> writes out the
JavaScript as <tt>.js</tt> files in the same directory, but output
well as debug them. In conjunction with
<a href="http://narwhaljs.org/">Narwhal</a>, the <tt>coffee-script</tt>
command also provides direct evaluation and an interactive REPL.
When compiling to JavaScript, <tt>coffee-script</tt> writes the output
as <tt>.js</tt> files in the same directory by default, but output
can be customized with the following options:
</p>

<table>
<tr>
<td width="25%"><code>-o, --output [DIR]</code></td>
<td width="25%"><code>-i, --interactive</code></td>
<td>
Launch an interactive CoffeeScript session.
Requires <a href="http://narwhaljs.org/">Narwhal</a>.
</td>
</tr>
<tr>
<td><code>-r, --run</code></td>
<td>
Compile and execute the CoffeeScripts without saving the intermediate
JavaScript. Requires <a href="http://narwhaljs.org/">Narwhal</a>.
</td>
</tr>
<tr>
<td><code>-o, --output [DIR]</code></td>
<td>
Write out all compiled JavaScript files into the specified directory.
</td>
Expand All @@ -195,7 +210,7 @@ <h2 id="installation">Installation and Usage</h2>
<td><code>-l, --lint</code></td>
<td>
If the <tt>jsl</tt> (JavaScript Lint) command is installed, use it
to check the compilation of a CoffeeScript file. (Handy in
to check the compilation of a CoffeeScript file. (Handy in
conjunction with <tt>--watch</tt>)
</td>
</tr>
Expand Down Expand Up @@ -264,15 +279,15 @@ <h2>Language Reference</h2>
the line will do just as well. All other whitespace is
not significant. Instead of using curly braces <tt>{ }</tt>
to delimit a block of code, use a period <tt>.</tt> to mark the end of a
block, for
<a href="#functions">functions</a>,
<a href="#conditionals">if-statements</a>,
block, for
<a href="#functions">functions</a>,
<a href="#conditionals">if-statements</a>,
<a href="#switch">switch</a>, and <a href="#try">try/catch</a>.
</p>

<p id="functions">
<b class="header">Functions and Invocation</b>
Functions are defined by a list of parameters, an arrow, and the
Functions are defined by a list of parameters, an arrow, and the
function body. The empty function looks like this: <tt>=>.</tt>
</p>
<div class='code'><pre class="idle"><span class="FunctionName">square</span><span class="Keyword">:</span> <span class="FunctionArgument">x</span> <span class="Storage">=&gt;</span> x <span class="Keyword">*</span> x.
Expand Down Expand Up @@ -453,7 +468,7 @@ <h2>Language Reference</h2>
The same mechanism is used to push down assignment through <b>switch</b>
statements, and <b>if-elses</b> (although the ternary operator is preferred).
</p>

<p id="aliases">
<b class="header">Aliases</b>
Because the <tt>==</tt> operator frequently causes undesirable coercion,
Expand All @@ -472,7 +487,7 @@ <h2>Language Reference</h2>
</p>
<p>
Instead of a newline or semicolon, <tt>then</tt> can be used to separate
conditions from expressions, in <b>while</b>,
conditions from expressions, in <b>while</b>,
<b>if</b>/<b>else</b>, and <b>switch</b>/<b>when</b> statements.
</p>
<p>
Expand Down Expand Up @@ -543,18 +558,18 @@ <h2>Language Reference</h2>
</pre><pre class="idle">
<span class="Comment"><span class="Comment">//</span> Eat lunch.</span>
<span class="Storage">var</span> lunch;
<span class="Storage">var</span> a <span class="Keyword">=</span> [<span class="String"><span class="String">'</span>toast<span class="String">'</span></span>, <span class="String"><span class="String">'</span>cheese<span class="String">'</span></span>, <span class="String"><span class="String">'</span>wine<span class="String">'</span></span>];
<span class="Storage">var</span> d <span class="Keyword">=</span> [];
<span class="Keyword">for</span> (<span class="Storage">var</span> b<span class="Keyword">=</span><span class="Number">0</span>, c<span class="Keyword">=</span>a.<span class="LibraryConstant">length</span>; b<span class="Keyword">&lt;</span>c; b<span class="Keyword">++</span>) {
<span class="Storage">var</span> food <span class="Keyword">=</span> a[b];
d[b] <span class="Keyword">=</span> food.eat();
<span class="Storage">var</span> __a <span class="Keyword">=</span> [<span class="String"><span class="String">'</span>toast<span class="String">'</span></span>, <span class="String"><span class="String">'</span>cheese<span class="String">'</span></span>, <span class="String"><span class="String">'</span>wine<span class="String">'</span></span>];
<span class="Storage">var</span> __d <span class="Keyword">=</span> [];
<span class="Keyword">for</span> (<span class="Storage">var</span> __b<span class="Keyword">=</span><span class="Number">0</span>, __c<span class="Keyword">=</span>__a.<span class="LibraryConstant">length</span>; __b<span class="Keyword">&lt;</span>__c; __b<span class="Keyword">++</span>) {
<span class="Storage">var</span> food <span class="Keyword">=</span> __a[__b];
__d[__b] <span class="Keyword">=</span> food.eat();
}
lunch <span class="Keyword">=</span> d;
lunch <span class="Keyword">=</span> __d;
<span class="Comment"><span class="Comment">//</span> Zebra-stripe a table.</span>
<span class="Storage">var</span> e <span class="Keyword">=</span> table;
<span class="Keyword">for</span> (<span class="Storage">var</span> f<span class="Keyword">=</span><span class="Number">0</span>, g<span class="Keyword">=</span>e.<span class="LibraryConstant">length</span>; f<span class="Keyword">&lt;</span>g; f<span class="Keyword">++</span>) {
<span class="Storage">var</span> row <span class="Keyword">=</span> e[f];
<span class="Storage">var</span> i <span class="Keyword">=</span> f;
<span class="Storage">var</span> __e <span class="Keyword">=</span> table;
<span class="Keyword">for</span> (<span class="Storage">var</span> __f<span class="Keyword">=</span><span class="Number">0</span>, __g<span class="Keyword">=</span>__e.<span class="LibraryConstant">length</span>; __f<span class="Keyword">&lt;</span>__g; __f<span class="Keyword">++</span>) {
<span class="Storage">var</span> row <span class="Keyword">=</span> __e[__f];
<span class="Storage">var</span> i <span class="Keyword">=</span> __f;
i <span class="Keyword">%</span> <span class="Number">2</span> <span class="Keyword">===</span> <span class="Number">0</span> ? highlight(row) : <span class="BuiltInConstant">null</span>;
}
</pre><br class='clear' /></div>
Expand Down Expand Up @@ -769,14 +784,14 @@ <h2>Language Reference</h2>
about a little and see the watery part of the \
world...";
;alert(moby_dick);'>run: moby_dick</button><br class='clear' /></div>

<h2 id="contributing">Contributing</h2>

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

<ul>
<li>
A JavaScript version of the compiler, perhaps using Alessandro Warth's
Expand All @@ -791,39 +806,53 @@ <h2 id="contributing">Contributing</h2>
should be able to compile properly.
</li>
<li>
A tutorial that introduces CoffeeScript from the ground up for folks
A tutorial that introduces CoffeeScript from the ground up for folks
without knowledge of JavaScript.
</li>
<li>
Integration with Processing.js's JavaScript API (this would depend on
having a JavaScript version of the compiler).
</li>
<li>
A lot of the code generation in <tt>nodes.rb</tt> gets into messy
A lot of the code generation in <tt>nodes.rb</tt> gets into messy
string manipulation. Techniques for cleaning this up across the board
would be appreciated.
</li>
</ul>

<h2 id="change_log">Change Log</h2>

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

<p>
<b class="header" style="margin-top: 20px;">0.1.2</b>
Fixed a bug with calling <tt>super()</tt> through more than one level of
Fixed a bug with calling <tt>super()</tt> through more than one level of
inheritance, with the re-addition of the <tt>extends</tt> keyword.
Added experimental <a href="http://narwhaljs.org/">Narwhal</a>
support (as a Tusk package), contributed by
Added experimental <a href="http://narwhaljs.org/">Narwhal</a>
support (as a Tusk package), contributed by
<a href="http://tlrobinson.net/">Tom Robinson</a>, including
<b>bin/cs</b> as a CoffeeScript REPL and interpreter.
New <tt>--no-wrap</tt> option to suppress the safety function
wrapper.
</p>

<p>
<b class="header" style="margin-top: 20px;">0.1.1</b>
Added <tt>instanceof</tt> and <tt>typeof</tt> as operators.
</p>

<p>
<b class="header" style="margin-top: 20px;">0.1.0</b>
Initial CoffeeScript release.
Expand Down
2 changes: 1 addition & 1 deletion lib/coffee-script.rb
Expand Up @@ -9,7 +9,7 @@
# Namespace for all CoffeeScript internal classes.
module CoffeeScript

VERSION = '0.1.2' # Keep in sync with the gemspec.
VERSION = '0.1.3' # Keep in sync with the gemspec.

# Compile a script (String or IO) to JavaScript.
def self.compile(script, options={})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -5,5 +5,5 @@
"description": "Unfancy JavaScript",
"keywords": ["javascript", "language"],
"author": "Jeremy Ashkenas",
"version": "0.1.2"
"version": "0.1.3"
}

0 comments on commit c4ba971

Please sign in to comment.