Skip to content

Commit

Permalink
added tonic example
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyan Zhang committed Aug 3, 2016
1 parent ac72908 commit 1407224
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions examples/tonic/tonicExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { interp, setLexical } = require('the-super-tiny-interpreter');

const code = `
const adder = (x) => (y) => x + y;
const x = 100;
const add3 = adder(3);
log(add3(5));
`;

setLexical(true);

interp(code); // should log `8`

setLexical(false);

interp(code); // should log 105
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
"testPathDirs": [
"<rootDir>/src"
]
}
},
"tonicExampleFilename": "examples/tonic/tonicExample.js"
}

0 comments on commit 1407224

Please sign in to comment.