|
107 | 107 | * 1. *Parsing* is taking raw code and turning it into a more abstract |
108 | 108 | * representation of the code. |
109 | 109 | * |
110 | | - * 2. *Transformation* takes this abstract representation and manipulates to do |
111 | | - * whatever the compiler wants it to. |
| 110 | + * 2. *Transformation* takes this abstract representation and manipulates it to |
| 111 | + * do whatever the compiler wants it to. |
112 | 112 | * |
113 | 113 | * 3. *Code Generation* takes the transformed representation of the code and |
114 | 114 | * turns it into new code. |
|
333 | 333 | * |
334 | 334 | * Code generators work several different ways, some compilers will reuse the |
335 | 335 | * tokens from earlier, others will have created a separate representation of |
336 | | - * the code so that they can print node linearly, but from what I can tell most |
| 336 | + * the code so that they can print nodes linearly, but from what I can tell most |
337 | 337 | * will use the same AST we just created, which is what we’re going to focus on. |
338 | 338 | * |
339 | 339 | * Effectively our code generator will know how to “print” all of the different |
@@ -629,7 +629,7 @@ function parser(tokens) { |
629 | 629 | // (add 2 (subtract 4 2)) |
630 | 630 | // |
631 | 631 | // You'll also notice that in our tokens array we have multiple closing |
632 | | - // parenthesis. |
| 632 | + // parentheses. |
633 | 633 | // |
634 | 634 | // [ |
635 | 635 | // { type: 'paren', value: '(' }, |
@@ -850,8 +850,8 @@ function transformer(ast) { |
850 | 850 | }; |
851 | 851 |
|
852 | 852 | // Next I'm going to cheat a little and create a bit of a hack. We're going to |
853 | | - // use a property named `context` on our parent nodes that we're going to push |
854 | | - // nodes to their parent's `context`. Normally you would have a better |
| 853 | + // use a property named `context` on our parent nodes that we're going to use |
| 854 | + // to push nodes to their parent's `context`. Normally you would have a better |
855 | 855 | // abstraction than this, but for our purposes this keeps things simple. |
856 | 856 | // |
857 | 857 | // Just take note that the context is a reference *from* the old ast *to* the |
|
0 commit comments