Repository: source-academy/js-slang
Pull request #402 (2020-02-23 14:54:37)

Simplify meta parser
removes position info from parse tree returned by parse function

coveralls: ## Pull Request Test Coverage Report for [Build 1889](https://coveralls.io/builds/28904460)

* **0** of **0**   changed or added relevant lines in **0** files are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage decreased (**-0.01%**) to **88.892%**

---



|  Totals | [![Coverage Status](https://coveralls.io/builds/28904460/badge)](https://coveralls.io/builds/28904460) |
| :-- | --: |
| Change from base [Build 1883](https://coveralls.io/builds/28815459): |  -0.01% |
| Covered Lines: | 2184 |
| Relevant Lines: | 2393 |

---
##### 💛  - [Coveralls](https://coveralls.io)


Patch:
diff --git a/src/stdlib/parser.ts b/src/stdlib/parser.ts
index 5a413333..18317bbd 100644
--- a/src/stdlib/parser.ts
+++ b/src/stdlib/parser.ts
@@ -139,17 +139,9 @@ transformers = new Map([
     'UnaryExpression',
     (node: es.Node) => {
       node = node as es.UnaryExpression
-      const loc = node.loc as es.SourceLocation
       return vector_to_list([
         'application',
-        vector_to_list([
-          'name',
-          node.operator,
-          vector_to_list([
-            vector_to_list([loc.start.line, loc.start.column]),
-            vector_to_list([loc.start.line, loc.start.column + 1])
-          ])
-        ]),
+        vector_to_list(['name', node.operator]),
         vector_to_list([transform(node.argument)])
       ])
     }
@@ -159,17 +151,9 @@ transformers = new Map([
     'BinaryExpression',
     (node: es.Node) => {
       node = node as es.BinaryExpression
-      const loc = node.right.loc as es.SourceLocation
       return vector_to_list([
         'application',
-        vector_to_list([
-          'name',
-          node.operator,
-          vector_to_list([
-            vector_to_list([loc.start.line, loc.start.column - 1]),
-            vector_to_list([loc.start.line, loc.start.column])
-          ])
-        ]),
+        vector_to_list(['name', node.operator]),
         vector_to_list([transform(node.left), transform(node.right)])
       ])
     }
@@ -179,17 +163,9 @@ transformers = new Map([
     'LogicalExpression',
     (node: es.Node) => {
       node = node as es.LogicalExpression
-      const loc = node.right.loc as es.SourceLocation
       return vector_to_list([
         'boolean_operation',
-        vector_to_list([
-          'name',
-          node.operator,
-          vector_to_list([
-            vector_to_list([loc.start.line, loc.start.column - 1]),
-            vector_to_list([loc.start.line, loc.start.column])
-          ])
-        ]),
+        vector_to_list(['name', node.operator]),
         vector_to_list([transform(node.left), transform(node.right)])
       ])
     }
@@ -212,7 +188,6 @@ transformers = new Map([
     'ArrowFunctionExpression',
     (node: es.Node) => {
       node = node as es.ArrowFunctionExpression
-      const loc = node.body.loc as es.SourceLocation
       return vector_to_list([
         'function_definition',
         vector_to_list(node.params.map(transform)),
@@ -221,14 +196,7 @@ transformers = new Map([
             // The body of a function is the statement
             // inside the curly braces.
             makeSequenceIfNeeded(node.body.body)
-          : vector_to_list([
-              'return_statement',
-              transform(node.body),
-              vector_to_list([
-                vector_to_list([loc.start.line, loc.start.column]),
-                vector_to_list([loc.end.line, loc.end.column])
-              ])
-            ])
+          : vector_to_list(['return_statement', transform(node.body)])
       ])
     }
   ],


Test patch:
diff --git a/src/__tests__/__snapshots__/allowed-syntax.ts.snap b/src/__tests__/__snapshots__/allowed-syntax.ts.snap
index f200106b..26c014f3 100644
--- a/src/__tests__/__snapshots__/allowed-syntax.ts.snap
+++ b/src/__tests__/__snapshots__/allowed-syntax.ts.snap
@@ -122,28 +122,7 @@ Object {
                                       "name",
                                       Array [
                                         "+",
-                                        Array [
-                                          Array [
-                                            Array [
-                                              2,
-                                              Array [
-                                                17,
-                                                null,
-                                              ],
-                                            ],
-                                            Array [
-                                              Array [
-                                                2,
-                                                Array [
-                                                  18,
-                                                  null,
-                                                ],
-                                              ],
-                                              null,
-                                            ],
-                                          ],
-                                          null,
-                                        ],
+                                        null,
                                       ],
                                     ],
                                     Array [
@@ -185,28 +164,7 @@ Object {
                                       "name",
                                       Array [
                                         ">",
-                                        Array [
-                                          Array [
-                                            Array [
-                                              3,
-                                              Array [
-                                                11,
-                                                null,
-                                              ],
-                                            ],
-                                            Array [
-                                              Array [
-                                                3,
-                                                Array [
-                                                  12,
-                                                  null,
-                                                ],
-                                              ],
-                                              null,
-                                            ],
-                                          ],
-                                          null,
-                                        ],
+                                        null,
                                       ],
                                     ],
                                     Array [
@@ -261,28 +219,7 @@ Object {
                                                   "name",
                                                   Array [
                                                     "===",
-                                                    Array [
-                                                      Array [
-                                                        Array [
-                                                          6,
-                                                          Array [
-                                                            17,
-                                                            null,
-                                                          ],
-                                                        ],
-                                                        Array [
-                                                          Array [
-                                                            6,
-                                                            Array [
-                                                              18,
-                                                              null,
-                                                            ],
-                                                          ],
-                                                          null,
-                                                        ],
-                                                      ],
-                                                      null,
-                                                    ],
+                                                    null,
                                                   ],
                                                 ],
                                                 Array [
@@ -294,28 +231,7 @@ Object {
                                                           "name",
                                                           Array [
                                                             "%",
-                                                            Array [
-                                                              Array [
-                                                                Array [
-                                                                  6,
-                                                                  Array [
-                                                                    11,
-                                                                    null,
-                                                                  ],
-                                                                ],
-                                                                Array [
-                                                                  Array [
-                                                                    6,
-                                                                    Array [
-                                                                      12,
-                                                                      null,
-                                                                    ],
-                                                                  ],
-                                                                  null,
-                                                                ],
-                                                              ],
-                                                              null,
-                                                            ],
+                                                            null,
                                                           ],
                                                         ],
                                                         Array [
@@ -359,28 +275,7 @@ Object {
                                                             "name",
                                                             Array [
                                                               "-",
-                                                              Array [
-                                                                Array [
-                                                                  Array [
-                                                                    7,
-                                                                    Array [
-                                                                      13,
-                                                                      null,
-                                                                    ],
-                                                                  ],
-                                                                  Array [
-                                                                    Array [
-                                                                      7,
-                                                                      Array [
-                                                                        14,
-                                                                        null,
-                                                                      ],
-                                                                    ],
-                                                                    null,
-                                                                  ],
-                                                                ],
-                                                                null,
-                                                              ],
+                                                              null,
                                                             ],
                                                           ],
                                                           Array [
@@ -409,28 +304,7 @@ Object {
                                                           "name",
                                                           Array [
                                                             "===",
-                                                            Array [
-                                                              Array [
-                                                                Array [
-                                                                  8,
-                                                                  Array [
-                                                                    24,
-                                                                    null,
-                                                                  ],
-                                                                ],
-                                                                Array [
-                                                                  Array [
-                                                                    8,
-                                                                    Array [
-                                                                      25,
-                                                                      null,
-                                                                    ],
-                                                                  ],
-                                                                  null,
-                                                                ],
-                                                              ],
-                                                              null,
-                                                            ],
+                                                            null,
                                                           ],
                                                         ],
                                                         Array [
@@ -442,28 +316,7 @@ Object {
                                                                   "name",
                                                                   Array [
                                                                     "%",
-                                                                    Array [
-                                                                      Array [
-                                                                        Array [
-                                                                          8,
-                                                                          Array [
-                                                                            18,
-                                                                            null,
-                                                                          ],
-                                                                        ],
-                                                                        Array [
-                                                                          Array [
-                                                                            8,
-                                                                            Array [
-                                                                              19,
-                                                                              null,
-                                                                            ],
-                                                                          ],
-                                                                          null,
-                                                                        ],
-                                                                      ],
-                                                                      null,
-                                                                    ],
+                                                                    null,
                                                                   ],
                                                                 ],
                                                                 Array [
@@ -524,28 +377,7 @@ Object {
                                                                           "name",
                                                                           Array [
                                                                             ">",
-                                                                            Array [
-                                                                              Array [
-                                                                                Array [
-                                                                                  11,
-                                                                                  Array [
-                                                                                    16,
-                                                                                    null,
-                                                                                  ],
-                                                                                ],
-                                                                                Array [
-                                                                                  Array [
-                                                                                    11,
-                                                                                    Array [
-                                                                                      17,
-                                                                                      null,
-                                                                                    ],
-                                                                                  ],
-                                                                                  null,
-                                                                                ],
-                                                                              ],
-                                                                              null,
-                                                                            ],
+                                                                            null,
                                                                           ],
                                                                         ],
                                                                         Array [
@@ -582,28 +414,7 @@ Object {
                                                                               "name",
                                                                               Array [
                                                                                 "-",
-                                                                                Array [
-                                                                                  Array [
-                                                                                    Array [
-                                                                                      11,
-                                                                                      Array [
-                                                                                        25,
-                                                                                        null,
-                                                                                      ],
-                                                                                    ],
-                                                                                    Array [
-                                                                                      Array [
-                                                                                        11,
-                                                                                        Array [
-                                                                                          26,
-                                                                                          null,
-                                                                                        ],
-                                                                                      ],
-                                                                                      null,
-                                                                                    ],
-                                                                                  ],
-                                                                                  null,
-                                                                                ],
+                                                                                null,
                                                                               ],
                                                                             ],
                                                                             Array [
@@ -817,28 +628,7 @@ Object {
               "return_statement",
               Array [
                 true,
-                Array [
-                  Array [
-                    Array [
-                      1,
-                      Array [
-                        7,
-                        null,
-                      ],
-                    ],
-                    Array [
-                      Array [
-                        1,
-                        Array [
-                          11,
-                          null,
-                        ],
-                      ],
-                      null,
-                    ],
-                  ],
-                  null,
-                ],
+                null,
               ],
             ],
             null,
@@ -956,28 +746,7 @@ Object {
                       "name",
                       Array [
                         "+",
-                        Array [
-                          Array [
-                            Array [
-                              1,
-                              Array [
-                                23,
-                                null,
-                              ],
-                            ],
-                            Array [
-                              Array [
-                                1,
-                                Array [
-                                  24,
-                                  null,
-                                ],
-                              ],
-                              null,
-                            ],
-                          ],
-                          null,
-                        ],
+                        null,
                       ],
                     ],
                     Array [
@@ -1309,28 +1078,7 @@ Object {
         "name",
         Array [
           "+",
-          Array [
-            Array [
-              Array [
-                1,
-                Array [
-                  6,
-                  null,
-                ],
-              ],
-              Array [
-                Array [
-                  1,
-                  Array [
-                    7,
-                    null,
-                  ],
-                ],
-                null,
-              ],
-            ],
-            null,
-          ],
+          null,
         ],
       ],
       Array [
@@ -1344,28 +1092,7 @@ Object {
                   "name",
                   Array [
                     "/",
-                    Array [
-                      Array [
-                        Array [
-                          1,
-                          Array [
-                            28,
-                            null,
-                          ],
-                        ],
-                        Array [
-                          Array [
-                            1,
-                            Array [
-                              29,
-                              null,
-                            ],
-                          ],
-                          null,
-                        ],
-                      ],
-                      null,
-                    ],
+                    null,
                   ],
                 ],
                 Array [
@@ -1377,28 +1104,7 @@ Object {
                           "name",
                           Array [
                             "%",
-                            Array [
-                              Array [
-                                Array [
-                                  1,
-                                  Array [
-                                    24,
-                                    null,
-                                  ],
-                                ],
-                                Array [
-                                  Array [
-                                    1,
-                                    Array [
-                                      25,
-                                      null,
-                                    ],
-                                  ],
-                                  null,
-                                ],
-                              ],
-                              null,
-                            ],
+                            null,
                           ],
                         ],
                         Array [
@@ -1410,28 +1116,7 @@ Object {
                                   "name",
                                   Array [
                                     "*",
-                                    Array [
-                                      Array [
-                                        Array [
-                                          1,
-                                          Array [
-                                            19,
-                                            null,
-                                          ],
-                                        ],
-                                        Array [
-                                          Array [
-                                            1,
-                                            Array [
-                                              20,
-                                              null,
-                                            ],
-                                          ],
-                                          null,
-                                        ],
-                                      ],
-                                      null,
-                                    ],
+                                    null,
                                   ],
                                 ],
                                 Array [
@@ -1443,28 +1128,7 @@ Object {
                                           "name",
                                           Array [
                                             "-",
-                                            Array [
-                                              Array [
-                                                Array [
-                                                  1,
-                                                  Array [
-                                                    8,
-                                                    null,
-                                                  ],
-                                                ],
-                                                Array [
-                                                  Array [
-                                                    1,
-                                                    Array [
-                                                      9,
-                                                      null,
-                                                    ],
-                                                  ],
-                                                  null,
-                                                ],
-                                              ],
-                                              null,
-                                            ],
+                                            null,
                                           ],
                                         ],
                                         Array [
@@ -1484,28 +1148,7 @@ Object {
                                             "name",
                                             Array [
                                               "-",
-                                              Array [
-                                                Array [
-                                                  Array [
-                                                    1,
-                                                    Array [
-                                                      20,
-                                                      null,
-                                                    ],
-                                                  ],
-                                                  Array [
-                                                    Array [
-                                                      1,
-                                                      Array [
-                                                        21,
-                                                        null,
-                                                      ],
-                                                    ],
-                                                    null,
-                                                  ],
-                                                ],
-                                                null,
-                                              ],
+                                              null,
                                             ],
                                           ],
                                           Array [
@@ -1625,28 +1268,7 @@ Object {
         "name",
         Array [
           "||",
-          Array [
-            Array [
-              Array [
-                1,
-                Array [
-                  61,
-                  null,
-                ],
-              ],
-              Array [
-                Array [
-                  1,
-                  Array [
-                    62,
-                    null,
-                  ],
-                ],
-                null,
-              ],
-            ],
-            null,
-          ],
+          null,
         ],
       ],
       Array [
@@ -1658,28 +1280,7 @@ Object {
                 "name",
                 Array [
                   "&&",
-                  Array [
-                    Array [
-                      Array [
-                        1,
-                        Array [
-                          52,
-                          null,
-                        ],
-                      ],
-                      Array [
-                        Array [
-                          1,
-                          Array [
-                            53,
-                            null,
-                          ],
-                        ],
-                        null,
-                      ],
-                    ],
-                    null,
-                  ],
+                  null,
                 ],
               ],
               Array [
@@ -1691,28 +1292,7 @@ Object {
                         "name",
                         Array [
                           "&&",
-                          Array [
-                            Array [
-                              Array [
-                                1,
-                                Array [
-                                  42,
-                                  null,
-                                ],
-                              ],
-                              Array [
-                                Array [
-                                  1,
-                                  Array [
-                                    43,
-                                    null,
-                                  ],
-                                ],
-                                null,
-                              ],
-                            ],
-                            null,
-                          ],
+                          null,
                         ],
                       ],
                       Array [
@@ -1724,28 +1304,7 @@ Object {
                                 "name",
                                 Array [
                                   "&&",
-                                  Array [
-                                    Array [
-                                      Array [
-                                        1,
-                                        Array [
-                                          32,
-                                          null,
-                                        ],
-                                      ],
-                                      Array [
-                                        Array [
-                                          1,
-                                          Array [
-                                            33,
-                                            null,
-                                          ],
-                                        ],
-                                        null,
-                                      ],
-                                    ],
-                                    null,
-                                  ],
+                                  null,
                                 ],
                               ],
                               Array [
@@ -1757,28 +1316,7 @@ Object {
                                         "name",
                                         Array [
                                           "&&",
-                                          Array [
-                                            Array [
-                                              Array [
-                                                1,
-                                                Array [
-                                                  23,
-                                                  null,
-                                                ],
-                                              ],
-                                              Array [
-                                                Array [
-                                                  1,
-                                                  Array [
-                                                    24,
-                                                    null,
-                                                  ],
-                                                ],
-                                                null,
-                                              ],
-                                            ],
-                                            null,
-                                          ],
+                                          null,
                                         ],
                                       ],
                                       Array [
@@ -1790,28 +1328,7 @@ Object {
                                                 "name",
                                                 Array [
                                                   "===",
-                                                  Array [
-                                                    Array [
-                                                      Array [
-                                                        1,
-                                                        Array [
-                                                          11,
-                                                          null,
-                                                        ],
-                                                      ],
-                                                      Array [
-                                                        Array [
-                                                          1,
-                                                          Array [
-                                                            12,
-                                                            null,
-                                                          ],
-                                                        ],
-                                                        null,
-                                                      ],
-                                                    ],
-                                                    null,
-                                                  ],
+                                                  null,
                                                 ],
                                               ],
                                               Array [
@@ -1823,28 +1340,7 @@ Object {
                                                         "name",
                                                         Array [
                                                           "!",
-                                                          Array [
-                                                            Array [
-                                                              Array [
-                                                                1,
-                                                                Array [
-                                                                  0,
-                                                                  null,
-                                                                ],
-                                                              ],
-                                                              Array [
-                                                                Array [
-                                                                  1,
-                                                                  Array [
-                                                                    1,
-                                                                    null,
-                                                                  ],
-                                                                ],
-                                                                null,
-                                                              ],
-                                                            ],
-                                                            null,
-                                                          ],
+                                                          null,
                                                         ],
                                                       ],
                                                       Array [
@@ -1863,64 +1359,7 @@ Object {
                                                         Array [
                                                           "name",
                                                           Array [
-                                                            "!==",
-                                                            Array [
-                                                              Array [
-                                                                Array [
-                                                                  1,
-                                                                  Array [
-                                                                    17,
-                                                                    null,
-                                                                  ],
-                                                                ],
-                                                                Array [
-                                                                  Array [
-                                                                    1,
-                                                                    Array [
-                                                                      18,
-                                                                      null,
-                                                                    ],
-                                                                  ],
-                                                                  null,
-                                                                ],
-                                                              ],
-                                                              null,
-                                                            ],
-                                                          ],
-                                                        ],
-                                                        Array [
-                                                          Array [
-                                                            1,
-                                                            Array [
-                                                              2,
-                                                              null,
-                                                            ],
-                                                          ],
-                                                          null,
-                                                        ],
-                                                      ],
-                                                    ],
-                                                    null,
-                                                  ],
-                                                ],
-                                                null,
-                                              ],
-                                            ],
-                                          ],
-                                          Array [
-                                            Array [
-                                              "application",
-                                              Array [
-                                                Array [
-                                                  "name",
-                                                  Array [
-                                                    "<",
-                                                    Array [
-                                                      Array [
-                                                        Array [
-                                                          1,
-                                                          Array [
-                                                            27,
+                                                            "!==",
                                                             null,
                                                           ],
                                                         ],
@@ -1928,15 +1367,30 @@ Object {
                                                           Array [
                                                             1,
                                                             Array [
-                                                              28,
+                                                              2,
                                                               null,
                                                             ],
                                                           ],
                                                           null,
                                                         ],
                                                       ],
-                                                      null,
                                                     ],
+                                                    null,
+                                                  ],
+                                                ],
+                                                null,
+                                              ],
+                                            ],
+                                          ],
+                                          Array [
+                                            Array [
+                                              "application",
+                                              Array [
+                                                Array [
+                                                  "name",
+                                                  Array [
+                                                    "<",
+                                                    null,
                                                   ],
                                                 ],
                                                 Array [
@@ -1966,28 +1420,7 @@ Object {
                                           "name",
                                           Array [
                                             "<=",
-                                            Array [
-                                              Array [
-                                                Array [
-                                                  1,
-                                                  Array [
-                                                    37,
-                                                    null,
-                                                  ],
-                                                ],
-                                                Array [
-                                                  Array [
-                                                    1,
-                                                    Array [
-                                                      38,
-                                                      null,
-                                                    ],
-                                                  ],
-                                                  null,
-                                                ],
-                                              ],
-                                              null,
-                                            ],
+                                            null,
                                           ],
                                         ],
                                         Array [
@@ -2017,28 +1450,7 @@ Object {
                                   "name",
                                   Array [
                                     ">=",
-                                    Array [
-                                      Array [
-                                        Array [
-                                          1,
-                                          Array [
-                                            47,
-                                            null,
-                                          ],
-                                        ],
-                                        Array [
-                                          Array [
-                                            1,
-                                            Array [
-                                              48,
-                                              null,
-                                            ],
-                                          ],
-                                          null,
-                                        ],
-                                      ],
-                                      null,
-                                    ],
+                                    null,
                                   ],
                                 ],
                                 Array [
@@ -2068,28 +1480,7 @@ Object {
                           "name",
                           Array [
                             ">",
-                            Array [
-                              Array [
-                                Array [
-                                  1,
-                                  Array [
-                                    56,
-                                    null,
-                                  ],
-                                ],
-                                Array [
-                                  Array [
-                                    1,
-                                    Array [
-                                      57,
-                                      null,
-                                    ],
-                                  ],
-                                  null,
-                                ],
-                              ],
-                              null,
-                            ],
+                            null,
                           ],
                         ],
                         Array [
@@ -3014,28 +2405,7 @@ Object {
                     "name",
                     Array [
                       "<",
-                      Array [
-                        Array [
-                          Array [
-                            2,
-                            Array [
-                              10,
-                              null,
-                            ],
-                          ],
-                          Array [
-                            Array [
-                              2,
-                              Array [
-                                11,
-                                null,
-                              ],
-                            ],
-                            null,
-                          ],
-                        ],
-                        null,
-                      ],
+                      null,
                     ],
                   ],
                   Array [
@@ -3078,28 +2448,7 @@ Object {
                                 "name",
                                 Array [
                                   "+",
-                                  Array [
-                                    Array [
-                                      Array [
-                                        3,
-                                        Array [
-                                          9,
-                                          null,
-                                        ],
-                                      ],
-                                      Array [
-                                        Array [
-                                          3,
-                                          Array [
-                                            10,
-                                            null,
-                                          ],
-                                        ],
-                                        null,
-                                      ],
-                                    ],
-                                    null,
-                                  ],
+                                  null,
                                 ],
                               ],
                               Array [
@@ -3733,28 +3082,7 @@ Object {
                       "name",
                       Array [
                         "<",
-                        Array [
-                          Array [
-                            Array [
-                              2,
-                              Array [
-                                15,
-                                null,
-                              ],
-                            ],
-                            Array [
-                              Array [
-                                2,
-                                Array [
-                                  16,
-                                  null,
-                                ],
-                              ],
-                              null,
-                            ],
-                          ],
-                          null,
-                        ],
+                        null,
                       ],
                     ],
                     Array [
@@ -3794,28 +3122,7 @@ Object {
                               "name",
                               Array [
                                 "+",
-                                Array [
-                                  Array [
-                                    Array [
-                                      2,
-                                      Array [
-                                        26,
-                                        null,
-                                      ],
-                                    ],
-                                    Array [
-                                      Array [
-                                        2,
-                                        Array [
-                                          27,
-                                          null,
-                                        ],
-                                      ],
-                                      null,
-                                    ],
-                                  ],
-                                  null,
-                                ],
+                                null,
                               ],
                             ],
                             Array [
@@ -4957,28 +4264,7 @@ Object {
                       "name",
                       Array [
                         "<",
-                        Array [
-                          Array [
-                            Array [
-                              2,
-                              Array [
-                                19,
-                                null,
-                              ],
-                            ],
-                            Array [
-                              Array [
-                                2,
-                                Array [
-                                  20,
-                                  null,
-                                ],
-                              ],
-                              null,
-                            ],
-                          ],
-                          null,
-                        ],
+                        null,
                       ],
                     ],
                     Array [
@@ -5018,28 +4304,7 @@ Object {
                               "name",
                               Array [
                                 "+",
-                                Array [
-                                  Array [
-                                    Array [
-                                      2,
-                                      Array [
-                                        30,
-                                        null,
-                                      ],
-                                    ],
-                                    Array [
-                                      Array [
-                                        2,
-                                        Array [
-                                          31,
-                                          null,
-                                        ],
-                                      ],
-                                      null,
-                                    ],
-                                  ],
-                                  null,
-                                ],
+                                null,
                               ],
                             ],
                             Array [
@@ -5078,28 +4343,7 @@ Object {
                                   "name",
                                   Array [
                                     "<",
-                                    Array [
-                                      Array [
-                                        Array [
-                                          3,
-                                          Array [
-                                            9,
-                                            null,
-                                          ],
-                                        ],
-                                        Array [
-                                          Array [
-                                            3,
-                                            Array [
-                                              10,
-                                              null,
-                                            ],
-                                          ],
-                                          null,
-                                        ],
-                                      ],
-                                      null,
-                                    ],
+                                    null,
                                   ],
                                 ],
                                 Array [
@@ -5157,28 +4401,7 @@ Object {
                                                       "name",
                                                       Array [
                                                         "+",
-                                                        Array [
-                                                          Array [
-                                                            Array [
-                                                              6,
-                                                              Array [
-                                                                11,
-                                                                null,
-                                                              ],
-                                                            ],
-                                                            Array [
-                                                              Array [
-                                                                6,
-                                                                Array [
-                                                                  12,
-                                                                  null,
-                                                                ],
-                                                              ],
-                                                              null,
-                                                            ],
-                                                          ],
-                                                          null,
-                                                        ],
+                                                        null,
                                                       ],
                                                     ],
                                                     Array [
@@ -5214,28 +4437,7 @@ Object {
                                                       "name",
                                                       Array [
                                                         ">",
-                                                        Array [
-                                                          Array [
-                                                            Array [
-                                                              7,
-                                                              Array [
-                                                                11,
-                                                                null,
-                                                              ],
-                                                            ],
-                                                            Array [
-                                                              Array [
-                                                                7,
-                                                                Array [
-                                                                  12,
-                                                                  null,
-                                                                ],
-                                                              ],
-                                                              null,
-                                                            ],
-                                                          ],
-                                                          null,
-                                                        ],
+                                                        null,
                                                       ],
                                                     ],
                                                     Array [
diff --git a/src/__tests__/__snapshots__/stringify.ts.snap b/src/__tests__/__snapshots__/stringify.ts.snap
index 65a24d6c..ec07de2c 100644
--- a/src/__tests__/__snapshots__/stringify.ts.snap
+++ b/src/__tests__/__snapshots__/stringify.ts.snap
@@ -993,9 +993,7 @@ Object {
   "parsedErrors": "",
   "result": "[\\"function_definition\\",
 [[[\\"name\\", [\\"x\\", null]], null],
-[[\\"return_statement\\",
- [[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]]],
-null]]]",
+[[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null]]]",
   "resultStatus": "finished",
   "transpiled": "const native = $$NATIVE_STORAGE;
 const callIfFuncAndRightArgs = native.operators.get(\\"callIfFuncAndRightArgs\\");
@@ -1032,9 +1030,7 @@ Object {
   "parsedErrors": "",
   "result": "[... \\"function_definition\\",
 [... [[\\"name\\", [\\"x\\", null]], null],
-[... [... \\"return_statement\\",
- ... [[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]] ...],
-null ...] ...] ...]",
+[[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null] ...] ...]",
   "resultStatus": "finished",
   "transpiled": "const native = $$NATIVE_STORAGE;
 const callIfFuncAndRightArgs = native.operators.get(\\"callIfFuncAndRightArgs\\");
@@ -1071,9 +1067,7 @@ Object {
   "parsedErrors": "",
   "result": "[ \\"function_definition\\",
 [ [[\\"name\\", [\\"x\\", null]], null],
-[ [ \\"return_statement\\",
-  [[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]] ],
-null ] ] ]",
+[[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null] ] ]",
   "resultStatus": "finished",
   "transpiled": "const native = $$NATIVE_STORAGE;
 const callIfFuncAndRightArgs = native.operators.get(\\"callIfFuncAndRightArgs\\");
@@ -1110,9 +1104,7 @@ Object {
   "parsedErrors": "",
   "result": "[.........\\"function_definition\\",
 [.........[[\\"name\\", [\\"x\\", null]], null],
-[.........[.........\\"return_statement\\",
-..........[[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]].........],
-null.........].........].........]",
+[[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null].........].........]",
   "resultStatus": "finished",
   "transpiled": "const native = $$NATIVE_STORAGE;
 const callIfFuncAndRightArgs = native.operators.get(\\"callIfFuncAndRightArgs\\");
@@ -1149,9 +1141,7 @@ Object {
   "parsedErrors": "",
   "result": "[         \\"function_definition\\",
 [         [[\\"name\\", [\\"x\\", null]], null],
-[         [         \\"return_statement\\",
-          [[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]]         ],
-null         ]         ]         ]",
+[[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null]         ]         ]",
   "resultStatus": "finished",
   "transpiled": "const native = $$NATIVE_STORAGE;
 const callIfFuncAndRightArgs = native.operators.get(\\"callIfFuncAndRightArgs\\");
@@ -1186,7 +1176,7 @@ Object {
   "displayResult": Array [],
   "errors": Array [],
   "parsedErrors": "",
-  "result": "[\\"function_definition\\", [[[\\"name\\", [\\"x\\", null]], null], [[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]]], null]]]",
+  "result": "[\\"function_definition\\", [[[\\"name\\", [\\"x\\", null]], null], [[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null]]]",
   "resultStatus": "finished",
   "transpiled": "const native = $$NATIVE_STORAGE;
 const callIfFuncAndRightArgs = native.operators.get(\\"callIfFuncAndRightArgs\\");
diff --git a/src/__tests__/stringify.ts b/src/__tests__/stringify.ts
index ca179675..07c24a08 100644
--- a/src/__tests__/stringify.ts
+++ b/src/__tests__/stringify.ts
@@ -404,7 +404,7 @@ test('String representation with no indent', () => {
   `,
     { chapter: 4, native: true }
   ).toMatchInlineSnapshot(
-    `"[\\"function_definition\\", [[[\\"name\\", [\\"x\\", null]], null], [[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]]], null]]]"`
+    `"[\\"function_definition\\", [[[\\"name\\", [\\"x\\", null]], null], [[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null]]]"`
   )
 })
 
@@ -417,9 +417,7 @@ test('String representation with 1 space indent', () => {
   ).toMatchInlineSnapshot(`
 "[\\"function_definition\\",
 [[[\\"name\\", [\\"x\\", null]], null],
-[[\\"return_statement\\",
- [[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]]],
-null]]]"
+[[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null]]]"
 `)
 })
 
@@ -432,9 +430,7 @@ test('String representation with default (2 space) indent', () => {
   ).toMatchInlineSnapshot(`
 "[ \\"function_definition\\",
 [ [[\\"name\\", [\\"x\\", null]], null],
-[ [ \\"return_statement\\",
-  [[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]] ],
-null ] ] ]"
+[[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null] ] ]"
 `)
 })
 
@@ -447,9 +443,7 @@ test('String representation with more than 10 space indent should trim to 10 spa
   ).toMatchInlineSnapshot(`
 "[         \\"function_definition\\",
 [         [[\\"name\\", [\\"x\\", null]], null],
-[         [         \\"return_statement\\",
-          [[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]]         ],
-null         ]         ]         ]"
+[[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null]         ]         ]"
 `)
 })
 
@@ -462,9 +456,7 @@ test('String representation with custom indent', () => {
   ).toMatchInlineSnapshot(`
 "[... \\"function_definition\\",
 [... [[\\"name\\", [\\"x\\", null]], null],
-[... [... \\"return_statement\\",
- ... [[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]] ...],
-null ...] ...] ...]"
+[[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null] ...] ...]"
 `)
 })
 
@@ -477,9 +469,7 @@ test('String representation with long custom indent gets trimmed to 10 character
   ).toMatchInlineSnapshot(`
 "[.........\\"function_definition\\",
 [.........[[\\"name\\", [\\"x\\", null]], null],
-[.........[.........\\"return_statement\\",
-..........[[\\"name\\", [\\"x\\", null]], [[[1, [3, null]], [[1, [4, null]], null]], null]].........],
-null.........].........].........]"
+[[\\"return_statement\\", [[\\"name\\", [\\"x\\", null]], null]], null].........].........]"
 `)
 })
 // tslint:enable:max-line-length
diff --git a/src/stdlib/__tests__/__snapshots__/parser.ts.snap b/src/stdlib/__tests__/__snapshots__/parser.ts.snap
index c7697654..a76d364c 100644
--- a/src/stdlib/__tests__/__snapshots__/parser.ts.snap
+++ b/src/stdlib/__tests__/__snapshots__/parser.ts.snap
@@ -20,28 +20,14 @@ Object {
     [ [ \\"application\\",
       [ [ \\"name\\",
         [ \\"+\\",
-        [ [ [ 1,
-            [ 18,
-            null ] ],
-          [ [ 1,
-            [ 19,
-            null ] ],
-          null ] ],
-        null ] ] ],
+        null ] ],
       [ [ [ \\"name\\",
           [ \\"x\\",
           null ] ],
         [ 1,
         null ] ],
       null ] ] ],
-    [ [ [ 1,
-        [ 15,
-        null ] ],
-      [ [ 1,
-        [ 20,
-        null ] ],
-      null ] ],
-    null ] ] ],
+    null ] ],
   null ] ] ],
 null ] ] ]",
   "resultStatus": "finished",
@@ -87,28 +73,14 @@ Object {
   [ [ \\"application\\",
     [ [ \\"name\\",
       [ \\"+\\",
-      [ [ [ 1,
-          [ 8,
-          null ] ],
-        [ [ 1,
-          [ 9,
-          null ] ],
-        null ] ],
-      null ] ] ],
+      null ] ],
     [ [ [ \\"name\\",
         [ \\"x\\",
         null ] ],
       [ 1,
       null ] ],
     null ] ] ],
-  [ [ [ 1,
-      [ 5,
-      null ] ],
-    [ [ 1,
-      [ 10,
-      null ] ],
-    null ] ],
-  null ] ] ],
+  null ] ],
 null ] ] ]",
   "resultStatus": "finished",
   "transpiled": "const native = $$NATIVE_STORAGE;
@@ -314,14 +286,7 @@ Object {
           [ [ \\"application\\",
             [ [ \\"name\\",
               [ \\"<=\\",
-              [ [ [ 1,
-                  [ 29,
-                  null ] ],
-                [ [ 1,
-                  [ 30,
-                  null ] ],
-                null ] ],
-              null ] ] ],
+              null ] ],
             [ [ [ \\"name\\",
                 [ \\"x\\",
                 null ] ],
@@ -334,14 +299,7 @@ Object {
           [ [ \\"application\\",
             [ [ \\"name\\",
               [ \\"+\\",
-              [ [ [ 1,
-                  [ 48,
-                  null ] ],
-                [ [ 1,
-                  [ 49,
-                  null ] ],
-                null ] ],
-              null ] ] ],
+              null ] ],
             [ [ [ \\"application\\",
                 [ [ \\"name\\",
                   [ \\"fib\\",
@@ -349,14 +307,7 @@ Object {
                 [ [ [ \\"application\\",
                     [ [ \\"name\\",
                       [ \\"-\\",
-                      [ [ [ 1,
-                          [ 43,
-                          null ] ],
-                        [ [ 1,
-                          [ 44,
-                          null ] ],
-                        null ] ],
-                      null ] ] ],
+                      null ] ],
                     [ [ [ \\"name\\",
                         [ \\"x\\",
                         null ] ],
@@ -372,14 +323,7 @@ Object {
                 [ [ [ \\"application\\",
                     [ [ \\"name\\",
                       [ \\"-\\",
-                      [ [ [ 1,
-                          [ 54,
-                          null ] ],
-                        [ [ 1,
-                          [ 55,
-                          null ] ],
-                        null ] ],
-                      null ] ] ],
+                      null ] ],
                     [ [ [ \\"name\\",
                         [ \\"x\\",
                         null ] ],
@@ -568,36 +512,15 @@ Object {
   "result": "[ \\"boolean_operation\\",
 [ [ \\"name\\",
   [ \\"||\\",
-  [ [ [ 1,
-      [ 14,
-      null ] ],
-    [ [ 1,
-      [ 15,
-      null ] ],
-    null ] ],
-  null ] ] ],
+  null ] ],
 [ [ [ \\"application\\",
     [ [ \\"name\\",
       [ \\"===\\",
-      [ [ [ 1,
-          [ 9,
-          null ] ],
-        [ [ 1,
-          [ 10,
-          null ] ],
-        null ] ],
-      null ] ] ],
+      null ] ],
     [ [ [ \\"application\\",
         [ [ \\"name\\",
           [ \\"+\\",
-          [ [ [ 1,
-              [ 3,
-              null ] ],
-            [ [ 1,
-              [ 4,
-              null ] ],
-            null ] ],
-          null ] ] ],
+          null ] ],
         [ [ 3,
           [ 5,
           null ] ],
@@ -608,25 +531,11 @@ Object {
   [ [ \\"boolean_operation\\",
     [ [ \\"name\\",
       [ \\"&&\\",
-      [ [ [ 1,
-          [ 23,
-          null ] ],
-        [ [ 1,
-          [ 24,
-          null ] ],
-        null ] ],
-      null ] ] ],
+      null ] ],
     [ [ [ \\"application\\",
         [ [ \\"name\\",
           [ \\"!\\",
-          [ [ [ 1,
-              [ 15,
-              null ] ],
-            [ [ 1,
-              [ 16,
-              null ] ],
-            null ] ],
-          null ] ] ],
+          null ] ],
         [ [ true,
           null ],
         null ] ] ],
@@ -737,14 +646,7 @@ Object {
     [ [ \\"application\\",
       [ [ \\"name\\",
         [ \\"<\\",
-        [ [ [ 1,
-            [ 53,
-            null ] ],
-          [ [ 1,
-            [ 54,
-            null ] ],
-          null ] ],
-        null ] ] ],
+        null ] ],
       [ [ [ \\"name\\",
           [ \\"i\\",
           null ] ],
@@ -758,14 +660,7 @@ Object {
       [ [ \\"application\\",
         [ [ \\"name\\",
           [ \\"+\\",
-          [ [ [ 1,
-              [ 64,
-              null ] ],
-            [ [ 1,
-              [ 65,
-              null ] ],
-            null ] ],
-          null ] ] ],
+          null ] ],
         [ [ [ \\"name\\",
             [ \\"i\\",
             null ] ],
@@ -793,14 +688,7 @@ Object {
     [ [ \\"application\\",
       [ [ \\"name\\",
         [ \\"<\\",
-        [ [ [ 1,
-            [ 104,
-            null ] ],
-          [ [ 1,
-            [ 105,
-            null ] ],
-          null ] ],
-        null ] ] ],
+        null ] ],
       [ [ [ \\"name\\",
           [ \\"i\\",
           null ] ],
@@ -814,14 +702,7 @@ Object {
       [ [ \\"application\\",
         [ [ \\"name\\",
           [ \\"+\\",
-          [ [ [ 1,
-              [ 115,
-              null ] ],
-            [ [ 1,
-              [ 116,
-              null ] ],
-            null ] ],
-          null ] ] ],
+          null ] ],
         [ [ [ \\"name\\",
             [ \\"i\\",
             null ] ],
@@ -891,28 +772,14 @@ Object {
     [ [ \\"application\\",
       [ [ \\"name\\",
         [ \\"+\\",
-        [ [ [ 1,
-            [ 23,
-            null ] ],
-          [ [ 1,
-            [ 24,
-            null ] ],
-          null ] ],
-        null ] ] ],
+        null ] ],
       [ [ [ \\"name\\",
           [ \\"x\\",
           null ] ],
         [ 1,
         null ] ],
       null ] ] ],
-    [ [ [ 1,
-        [ 20,
-        null ] ],
-      [ [ 1,
-        [ 25,
-        null ] ],
-      null ] ],
-    null ] ] ],
+    null ] ],
   null ] ] ],
 null ] ] ]",
   "resultStatus": "finished",
@@ -961,28 +828,14 @@ Object {
   [ [ \\"application\\",
     [ [ \\"name\\",
       [ \\"+\\",
-      [ [ [ 1,
-          [ 13,
-          null ] ],
-        [ [ 1,
-          [ 14,
-          null ] ],
-        null ] ],
-      null ] ] ],
+      null ] ],
     [ [ [ \\"name\\",
         [ \\"x\\",
         null ] ],
       [ 1,
       null ] ],
     null ] ] ],
-  [ [ [ 1,
-      [ 10,
-      null ] ],
-    [ [ 1,
-      [ 15,
-      null ] ],
-    null ] ],
-  null ] ] ],
+  null ] ],
 null ] ] ]",
   "resultStatus": "finished",
   "transpiled": "const native = $$NATIVE_STORAGE;
@@ -1030,28 +883,14 @@ Object {
   [ [ \\"application\\",
     [ [ \\"name\\",
       [ \\"+\\",
-      [ [ [ 1,
-          [ 13,
-          null ] ],
-        [ [ 1,
-          [ 14,
-          null ] ],
-        null ] ],
-      null ] ] ],
+      null ] ],
     [ [ [ \\"name\\",
         [ \\"x\\",
         null ] ],
       [ 1,
       null ] ],
     null ] ] ],
-  [ [ [ 1,
-      [ 10,
-      null ] ],
-    [ [ 1,
-      [ 15,
-      null ] ],
-    null ] ],
-  null ] ] ],
+  null ] ],
 null ] ] ]",
   "resultStatus": "finished",
   "transpiled": "const native = $$NATIVE_STORAGE;