Skip to content
Open
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
12 changes: 6 additions & 6 deletions the-super-tiny-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
* 1. *Parsing* is taking raw code and turning it into a more abstract
* representation of the code.
*
* 2. *Transformation* takes this abstract representation and manipulates to do
* whatever the compiler wants it to.
* 2. *Transformation* takes this abstract representation and manipulates it to
* do whatever the compiler wants it to.
*
* 3. *Code Generation* takes the transformed representation of the code and
* turns it into new code.
Expand Down Expand Up @@ -333,7 +333,7 @@
*
* Code generators work several different ways, some compilers will reuse the
* tokens from earlier, others will have created a separate representation of
* the code so that they can print node linearly, but from what I can tell most
* the code so that they can print nodes linearly, but from what I can tell most
* will use the same AST we just created, which is what we’re going to focus on.
*
* Effectively our code generator will know how to “print” all of the different
Expand Down Expand Up @@ -629,7 +629,7 @@ function parser(tokens) {
// (add 2 (subtract 4 2))
//
// You'll also notice that in our tokens array we have multiple closing
// parenthesis.
// parentheses.
//
// [
// { type: 'paren', value: '(' },
Expand Down Expand Up @@ -850,8 +850,8 @@ function transformer(ast) {
};

// Next I'm going to cheat a little and create a bit of a hack. We're going to
// use a property named `context` on our parent nodes that we're going to push
// nodes to their parent's `context`. Normally you would have a better
// use a property named `context` on our parent nodes that we're going to use
// to push nodes to their parent's `context`. Normally you would have a better
// abstraction than this, but for our purposes this keeps things simple.
//
// Just take note that the context is a reference *from* the old ast *to* the
Expand Down