mirror of
https://github.com/jamiebuilds/the-super-tiny-compiler.git
synced 2024-10-27 20:34:08 +00:00
Add Babel compilation
For us ES3 users who can't use ES6 features.
This commit is contained in:
parent
3356bea996
commit
3949a69276
8
.babelrc
Normal file
8
.babelrc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
"es2015",
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
"transform-es2015-modules-commonjs"
|
||||||
|
]
|
||||||
|
}
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
node_modules
|
||||||
|
*.log
|
||||||
|
lib
|
@ -1,5 +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>
|
[![](https://cloud.githubusercontent.com/assets/952783/14171276/ed7bf716-f6e6-11e5-96df-80a031c2769d.png)](src/super-tiny-compiler.js)
|
||||||
|
|
||||||
***Welcome to The Super Tiny Compiler!***
|
***Welcome to The Super Tiny Compiler!***
|
||||||
|
|
||||||
This is an ultra-simplified example of all the major pieces of a modern 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
|
Reading through the guided code will help you learn about how *most* compilers
|
||||||
work from end to end.
|
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?
|
### 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.
|
file.
|
||||||
|
|
||||||
### I'm back, that didn't make sense
|
### I'm back, that didn't make sense
|
||||||
@ -39,7 +38,7 @@ watch/star this repo or follow me on
|
|||||||
|
|
||||||
### Tests
|
### Tests
|
||||||
|
|
||||||
Run with `node test.js`
|
Run with `npm test`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
27
package.json
Normal file
27
package.json
Normal file
@ -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 <me@thejameskyle.com>",
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
2
test.js
2
test.js
@ -1,4 +1,4 @@
|
|||||||
var superTinyCompiler = require('./super-tiny-compiler');
|
var superTinyCompiler = require('./lib/super-tiny-compiler');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
|
||||||
var tokenizer = superTinyCompiler.tokenizer;
|
var tokenizer = superTinyCompiler.tokenizer;
|
||||||
|
Loading…
Reference in New Issue
Block a user