diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..b490b80 --- /dev/null +++ b/.babelrc @@ -0,0 +1,8 @@ +{ + "presets": [ + "es2015", + ], + "plugins": [ + "transform-es2015-modules-commonjs" + ] +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..45f7222 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +*.log +lib diff --git a/README.md b/README.md index 27cdc65..c809bb3 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -THE SUPER TINY COMPILER - +[![](https://cloud.githubusercontent.com/assets/952783/14171276/ed7bf716-f6e6-11e5-96df-80a031c2769d.png)](src/super-tiny-compiler.js) ***Welcome to The Super Tiny Compiler!*** This is an ultra-simplified example of all the major pieces of a modern compiler @@ -8,7 +7,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](src/super-tiny-compiler.js) --- @@ -27,7 +26,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 [src/super-tiny-compiler.js](src/super-tiny-compiler.js) file. ### I'm back, that didn't make sense @@ -39,7 +38,7 @@ watch/star this repo or follow me on ### Tests -Run with `node test.js` +Run with `npm test` --- diff --git a/package.json b/package.json new file mode 100644 index 0000000..9517e8d --- /dev/null +++ b/package.json @@ -0,0 +1,27 @@ +{ + "name": "the-super-tiny-compiler", + "version": "1.0.0", + "description": "Possibly the smallest compiler ever", + "main": "lib/super-tiny-compiler.js", + "scripts": { + "test": "npm run build && node test.js", + "build": "babel src -d lib", + "prepublish": "npm run build" + }, + "repository": "thejameskyle/the-super-tiny-compiler", + "keywords": [ + "compiler", + "tiny", + "example" + ], + "author": "James Kyle ", + "license": "CC-BY-4.0", + "bugs": { + "url": "https://github.com/thejameskyle/the-super-tiny-compiler/issues" + }, + "homepage": "https://github.com/thejameskyle/the-super-tiny-compiler", + "devDependencies": { + "babel-cli": "^6.16.0", + "babel-preset-es2015": "^6.16.0" + } +} diff --git a/super-tiny-compiler.js b/src/super-tiny-compiler.js similarity index 100% rename from super-tiny-compiler.js rename to src/super-tiny-compiler.js diff --git a/test.js b/test.js index ef351a8..75d7115 100755 --- a/test.js +++ b/test.js @@ -1,4 +1,4 @@ -var superTinyCompiler = require('./super-tiny-compiler'); +var superTinyCompiler = require('./lib/super-tiny-compiler'); var assert = require('assert'); var tokenizer = superTinyCompiler.tokenizer;