Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"escodegen": "0.0.22",
"source-map": "0.1.8",
"underscore": "1.2.0",
"unicode-categories": "0.9.1"
"unicode-categories": "0.9.1",
"brushtail": "0.0.1"
},
"devDependencies": {
"jison": "0.2.7",
Expand Down
1 change: 1 addition & 0 deletions site/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ <h2>About</h2>
<li><a href="http://en.wikipedia.org/wiki/Pattern_matching">Pattern matching</a></li>
<li><a href="http://en.wikipedia.org/wiki/Structural_type_system">Structural typing</a></li>
<li><a href="http://en.wikipedia.org/wiki/Monad_%28functional_programming%29#do-notation">Monad syntax</a></li>
<li><a href="http://en.wikipedia.org/wiki/Tail_call_optimization">Tail call optimization</a></li>
<li><a href="http://en.wikipedia.org/wiki/Currying">Automatic currying</a></li>
<li><a href="http://en.wikipedia.org/wiki/Eager_evaluation">Eager evaluation</a></li>
</ul>
Expand Down
3 changes: 3 additions & 0 deletions src/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var typecheck = require('./typeinference').typecheck,
lexer = require('./lexer'),
parser = require('../lib/parser').parser,
typeparser = require('../lib/typeparser').parser,
brushtail = require('brushtail'),
escodegen = require('escodegen'),
_ = require('underscore');

Expand Down Expand Up @@ -909,6 +910,8 @@ var compile = function(source, env, aliases, opts) {
});
}

brushtail.mutateAST(jsAst);

return {
type: resultType,
output: escodegen.generate(
Expand Down
3 changes: 3 additions & 0 deletions test/CompileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,8 @@ describe('compiler', function(){
it('with.roy with expected output', function() {
expectExecutionToHaveExpectedOutput('good/with');
});
it('tco.roy with expected output', function() {
expectExecutionToHaveExpectedOutput('good/tco');
});
});
});
1 change: 1 addition & 0 deletions test/fixtures/good/tco.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1000000
7 changes: 7 additions & 0 deletions test/fixtures/good/tco.roy
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let count from to =
if from >= to then
from
else
count (from + 1) to

console.log (count 0 1000000)