eggtended-js
Version:
A extended version of the Egg programming language from the Eloquent Javascript book.
1,640 lines • 34.6 kB
JSON
{
"type": "File",
"start": 0,
"end": 216,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 10,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 216,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 10,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 35
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 9,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 14
}
},
"imported": {
"type": "Identifier",
"start": 9,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "Lexer"
},
"name": "Lexer"
},
"local": {
"type": "Identifier",
"start": 9,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "Lexer"
},
"name": "Lexer"
}
}
],
"source": {
"type": "StringLiteral",
"start": 22,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 34
}
},
"extra": {
"rawValue": "./lexer.js",
"raw": "\"./lexer.js\""
},
"value": "./lexer.js"
}
},
{
"type": "ImportDeclaration",
"start": 36,
"end": 72,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 36
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 45,
"end": 51,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 15
}
},
"imported": {
"type": "Identifier",
"start": 45,
"end": 51,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 15
},
"identifierName": "Parser"
},
"name": "Parser"
},
"local": {
"type": "Identifier",
"start": 45,
"end": 51,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 15
},
"identifierName": "Parser"
},
"name": "Parser"
}
}
],
"source": {
"type": "StringLiteral",
"start": 59,
"end": 71,
"loc": {
"start": {
"line": 2,
"column": 23
},
"end": {
"line": 2,
"column": 35
}
},
"extra": {
"rawValue": "./parse.js",
"raw": "\"./parse.js\""
},
"value": "./parse.js"
}
},
{
"type": "ImportDeclaration",
"start": 73,
"end": 118,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 45
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 82,
"end": 92,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 19
}
},
"imported": {
"type": "Identifier",
"start": 82,
"end": 92,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 19
},
"identifierName": "TokenRegex"
},
"name": "TokenRegex"
},
"local": {
"type": "Identifier",
"start": 82,
"end": 92,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 19
},
"identifierName": "TokenRegex"
},
"name": "TokenRegex"
}
}
],
"source": {
"type": "StringLiteral",
"start": 100,
"end": 117,
"loc": {
"start": {
"line": 3,
"column": 27
},
"end": {
"line": 3,
"column": 44
}
},
"extra": {
"rawValue": "./tokenRegex.js",
"raw": "\"./tokenRegex.js\""
},
"value": "./tokenRegex.js"
}
},
{
"type": "ImportDeclaration",
"start": 119,
"end": 160,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 41
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 128,
"end": 136,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 17
}
},
"imported": {
"type": "Identifier",
"start": 128,
"end": 136,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 17
},
"identifierName": "json2AST"
},
"name": "json2AST"
},
"local": {
"type": "Identifier",
"start": 128,
"end": 136,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 17
},
"identifierName": "json2AST"
},
"name": "json2AST"
}
}
],
"source": {
"type": "StringLiteral",
"start": 144,
"end": 159,
"loc": {
"start": {
"line": 4,
"column": 25
},
"end": {
"line": 4,
"column": 40
}
},
"extra": {
"rawValue": "./json2AST.js",
"raw": "\"./json2AST.js\""
},
"value": "./json2AST.js"
}
},
{
"type": "ExportNamedDeclaration",
"start": 162,
"end": 215,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 9,
"column": 13
}
},
"declaration": null,
"specifiers": [
{
"type": "ExportSpecifier",
"start": 171,
"end": 176,
"loc": {
"start": {
"line": 6,
"column": 9
},
"end": {
"line": 6,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 171,
"end": 176,
"loc": {
"start": {
"line": 6,
"column": 9
},
"end": {
"line": 6,
"column": 14
},
"identifierName": "Lexer"
},
"name": "Lexer"
},
"exported": {
"type": "Identifier",
"start": 171,
"end": 176,
"loc": {
"start": {
"line": 6,
"column": 9
},
"end": {
"line": 6,
"column": 14
},
"identifierName": "Lexer"
},
"name": "Lexer"
}
},
{
"type": "ExportSpecifier",
"start": 180,
"end": 186,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 8
}
},
"local": {
"type": "Identifier",
"start": 180,
"end": 186,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 8
},
"identifierName": "Parser"
},
"name": "Parser"
},
"exported": {
"type": "Identifier",
"start": 180,
"end": 186,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 8
},
"identifierName": "Parser"
},
"name": "Parser"
}
},
{
"type": "ExportSpecifier",
"start": 190,
"end": 200,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 12
}
},
"local": {
"type": "Identifier",
"start": 190,
"end": 200,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 12
},
"identifierName": "TokenRegex"
},
"name": "TokenRegex"
},
"exported": {
"type": "Identifier",
"start": 190,
"end": 200,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 12
},
"identifierName": "TokenRegex"
},
"name": "TokenRegex"
}
},
{
"type": "ExportSpecifier",
"start": 204,
"end": 212,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 10
}
},
"local": {
"type": "Identifier",
"start": 204,
"end": 212,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 10
},
"identifierName": "json2AST"
},
"name": "json2AST"
},
"exported": {
"type": "Identifier",
"start": 204,
"end": 212,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 10
},
"identifierName": "json2AST"
},
"name": "json2AST"
}
}
],
"source": null
}
],
"directives": []
},
"comments": [],
"tokens": [
{
"type": {
"label": "import",
"keyword": "import",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "import",
"start": 0,
"end": 6,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 7,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 8
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Lexer",
"start": 9,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 14
}
}
},
{
"type": {
"label": "}",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "from",
"start": 17,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 21
}
}
},
{
"type": {
"label": "string",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "./lexer.js",
"start": 22,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 34
}
}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 34,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 35
}
}
},
{
"type": {
"label": "import",
"keyword": "import",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "import",
"start": 36,
"end": 42,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 6
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 43,
"end": 44,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 8
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Parser",
"start": 45,
"end": 51,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 15
}
}
},
{
"type": {
"label": "}",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 52,
"end": 53,
"loc": {
"start": {
"line": 2,
"column": 16
},
"end": {
"line": 2,
"column": 17
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "from",
"start": 54,
"end": 58,
"loc": {
"start": {
"line": 2,
"column": 18
},
"end": {
"line": 2,
"column": 22
}
}
},
{
"type": {
"label": "string",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "./parse.js",
"start": 59,
"end": 71,
"loc": {
"start": {
"line": 2,
"column": 23
},
"end": {
"line": 2,
"column": 35
}
}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 71,
"end": 72,
"loc": {
"start": {
"line": 2,
"column": 35
},
"end": {
"line": 2,
"column": 36
}
}
},
{
"type": {
"label": "import",
"keyword": "import",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "import",
"start": 73,
"end": 79,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 6
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 80,
"end": 81,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 8
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "TokenRegex",
"start": 82,
"end": 92,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 19
}
}
},
{
"type": {
"label": "}",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 93,
"end": 94,
"loc": {
"start": {
"line": 3,
"column": 20
},
"end": {
"line": 3,
"column": 21
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "from",
"start": 95,
"end": 99,
"loc": {
"start": {
"line": 3,
"column": 22
},
"end": {
"line": 3,
"column": 26
}
}
},
{
"type": {
"label": "string",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "./tokenRegex.js",
"start": 100,
"end": 117,
"loc": {
"start": {
"line": 3,
"column": 27
},
"end": {
"line": 3,
"column": 44
}
}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 117,
"end": 118,
"loc": {
"start": {
"line": 3,
"column": 44
},
"end": {
"line": 3,
"column": 45
}
}
},
{
"type": {
"label": "import",
"keyword": "import",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "import",
"start": 119,
"end": 125,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 6
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 126,
"end": 127,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 8
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "json2AST",
"start": 128,
"end": 136,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 17
}
}
},
{
"type": {
"label": "}",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 137,
"end": 138,
"loc": {
"start": {
"line": 4,
"column": 18
},
"end": {
"line": 4,
"column": 19
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "from",
"start": 139,
"end": 143,
"loc": {
"start": {
"line": 4,
"column": 20
},
"end": {
"line": 4,
"column": 24
}
}
},
{
"type": {
"label": "string",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "./json2AST.js",
"start": 144,
"end": 159,
"loc": {
"start": {
"line": 4,
"column": 25
},
"end": {
"line": 4,
"column": 40
}
}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 159,
"end": 160,
"loc": {
"start": {
"line": 4,
"column": 40
},
"end": {
"line": 4,
"column": 41
}
}
},
{
"type": {
"label": "export",
"keyword": "export",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "export",
"start": 162,
"end": 168,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 6
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 169,
"end": 170,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 8
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Lexer",
"start": 171,
"end": 176,
"loc": {
"start": {
"line": 6,
"column": 9
},
"end": {
"line": 6,
"column": 14
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 176,
"end": 177,
"loc": {
"start": {
"line": 6,
"column": 14
},
"end": {
"line": 6,
"column": 15
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Parser",
"start": 180,
"end": 186,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 8
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 186,
"end": 187,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 9
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "TokenRegex",
"start": 190,
"end": 200,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 12
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 200,
"end": 201,
"loc": {
"start": {
"line": 8,
"column": 12
},
"end": {
"line": 8,
"column": 13
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "json2AST",
"start": 204,
"end": 212,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 10
}
}
},
{
"type": {
"label": "}",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 213,
"end": 214,
"loc": {
"start": {
"line": 9,
"column": 11
},
"end": {
"line": 9,
"column": 12
}
}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 214,
"end": 215,
"loc": {
"start": {
"line": 9,
"column": 12
},
"end": {
"line": 9,
"column": 13
}
}
},
{
"type": {
"label": "eof",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 216,
"end": 216,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 0
}
}
}
]
}