Skip to content

Commit

Permalink
Prepare for greatness
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiebuilds committed Dec 31, 2016
1 parent 3356bea commit c4cb49b
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 118 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a href="super-tiny-compiler.js"><img width="731" alt="THE SUPER TINY COMPILER" src="https://cloud.githubusercontent.com/assets/952783/14171276/ed7bf716-f6e6-11e5-96df-80a031c2769d.png"/></a>
<a href="the-super-tiny-compiler.js"><img width="731" alt="THE SUPER TINY COMPILER" src="https://cloud.githubusercontent.com/assets/952783/14171276/ed7bf716-f6e6-11e5-96df-80a031c2769d.png"/></a>

***Welcome to The Super Tiny Compiler!***

Expand All @@ -8,7 +8,7 @@ written in easy to read JavaScript.
Reading through the guided code will help you learn about how *most* compilers
work from end to end.

### [Want to jump into the code? Click here](super-tiny-compiler.js)
### [Want to jump into the code? Click here](the-super-tiny-compiler.js)

---

Expand All @@ -27,7 +27,7 @@ the nerds are able to understand.

### Okay so where do I begin?

Awesome! Head on over to the [super-tiny-compiler.js](super-tiny-compiler.js)
Awesome! Head on over to the [the-super-tiny-compiler.js](the-super-tiny-compiler.js)
file.

### I'm back, that didn't make sense
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "the-super-tiny-compiler",
"version": "0.0.0",
"author": "James Kyle <[email protected]> (thejameskyle.com)",
"license": "CC-BY-4.0",
"main": "./the-super-tiny-compiler.js"
}
26 changes: 13 additions & 13 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
var superTinyCompiler = require('./super-tiny-compiler');
var assert = require('assert');
const {
tokenizer,
parser,
transformer,
codeGenerator,
compiler,
} = require('./super-tiny-compiler');
const assert = require('assert');

var tokenizer = superTinyCompiler.tokenizer;
var parser = superTinyCompiler.parser;
var transformer = superTinyCompiler.transformer;
var codeGenerator = superTinyCompiler.codeGenerator;
var compiler = superTinyCompiler.compiler;
const input = '(add 2 (subtract 4 2))';
const output = 'add(2, subtract(4, 2));';

var input = '(add 2 (subtract 4 2))';
var output = 'add(2, subtract(4, 2));';

var tokens = [
const tokens = [
{ type: 'paren', value: '(' },
{ type: 'name', value: 'add' },
{ type: 'number', value: '2' },
Expand All @@ -22,7 +22,7 @@ var tokens = [
{ type: 'paren', value: ')' }
];

var ast = {
const ast = {
type: 'Program',
body: [{
type: 'CallExpression',
Expand All @@ -44,7 +44,7 @@ var ast = {
}]
};

var newAst = {
const newAst = {
type: 'Program',
body: [{
type: 'ExpressionStatement',
Expand Down
Loading

0 comments on commit c4cb49b

Please sign in to comment.