eggtended-js
Version:
A extended version of the Egg programming language from the Eloquent Javascript book.
1,506 lines • 32.2 kB
JSON
{
"type": "File",
"start": 0,
"end": 144,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 9,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 144,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 9,
"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": "Eggvm"
},
"name": "Eggvm"
},
"local": {
"type": "Identifier",
"start": 9,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "Eggvm"
},
"name": "Eggvm"
}
}
],
"source": {
"type": "StringLiteral",
"start": 22,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 34
}
},
"extra": {
"rawValue": "./eggvm.js",
"raw": "\"./eggvm.js\""
},
"value": "./eggvm.js"
}
},
{
"type": "ImportDeclaration",
"start": 36,
"end": 89,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 53
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 45,
"end": 50,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
}
},
"imported": {
"type": "Identifier",
"start": 45,
"end": 50,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
},
"identifierName": "Value"
},
"name": "Value"
},
"local": {
"type": "Identifier",
"start": 45,
"end": 50,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
},
"identifierName": "Value"
},
"name": "Value"
}
},
{
"type": "ImportSpecifier",
"start": 52,
"end": 56,
"loc": {
"start": {
"line": 2,
"column": 16
},
"end": {
"line": 2,
"column": 20
}
},
"imported": {
"type": "Identifier",
"start": 52,
"end": 56,
"loc": {
"start": {
"line": 2,
"column": 16
},
"end": {
"line": 2,
"column": 20
},
"identifierName": "Word"
},
"name": "Word"
},
"local": {
"type": "Identifier",
"start": 52,
"end": 56,
"loc": {
"start": {
"line": 2,
"column": 16
},
"end": {
"line": 2,
"column": 20
},
"identifierName": "Word"
},
"name": "Word"
}
},
{
"type": "ImportSpecifier",
"start": 58,
"end": 63,
"loc": {
"start": {
"line": 2,
"column": 22
},
"end": {
"line": 2,
"column": 27
}
},
"imported": {
"type": "Identifier",
"start": 58,
"end": 63,
"loc": {
"start": {
"line": 2,
"column": 22
},
"end": {
"line": 2,
"column": 27
},
"identifierName": "Apply"
},
"name": "Apply"
},
"local": {
"type": "Identifier",
"start": 58,
"end": 63,
"loc": {
"start": {
"line": 2,
"column": 22
},
"end": {
"line": 2,
"column": 27
},
"identifierName": "Apply"
},
"name": "Apply"
}
},
{
"type": "ImportSpecifier",
"start": 65,
"end": 70,
"loc": {
"start": {
"line": 2,
"column": 29
},
"end": {
"line": 2,
"column": 34
}
},
"imported": {
"type": "Identifier",
"start": 65,
"end": 70,
"loc": {
"start": {
"line": 2,
"column": 29
},
"end": {
"line": 2,
"column": 34
},
"identifierName": "Regex"
},
"name": "Regex"
},
"local": {
"type": "Identifier",
"start": 65,
"end": 70,
"loc": {
"start": {
"line": 2,
"column": 29
},
"end": {
"line": 2,
"column": 34
},
"identifierName": "Regex"
},
"name": "Regex"
}
}
],
"source": {
"type": "StringLiteral",
"start": 78,
"end": 88,
"loc": {
"start": {
"line": 2,
"column": 42
},
"end": {
"line": 2,
"column": 52
}
},
"extra": {
"rawValue": "./ast.js",
"raw": "\"./ast.js\""
},
"value": "./ast.js"
}
},
{
"type": "ExportNamedDeclaration",
"start": 91,
"end": 143,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 8,
"column": 10
}
},
"declaration": null,
"specifiers": [
{
"type": "ExportSpecifier",
"start": 100,
"end": 105,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 100,
"end": 105,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 14
},
"identifierName": "Eggvm"
},
"name": "Eggvm"
},
"exported": {
"type": "Identifier",
"start": 100,
"end": 105,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 14
},
"identifierName": "Eggvm"
},
"name": "Eggvm"
}
},
{
"type": "ExportSpecifier",
"start": 109,
"end": 114,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 7
}
},
"local": {
"type": "Identifier",
"start": 109,
"end": 114,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 7
},
"identifierName": "Value"
},
"name": "Value"
},
"exported": {
"type": "Identifier",
"start": 109,
"end": 114,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 7
},
"identifierName": "Value"
},
"name": "Value"
}
},
{
"type": "ExportSpecifier",
"start": 118,
"end": 122,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 6
}
},
"local": {
"type": "Identifier",
"start": 118,
"end": 122,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 6
},
"identifierName": "Word"
},
"name": "Word"
},
"exported": {
"type": "Identifier",
"start": 118,
"end": 122,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 6
},
"identifierName": "Word"
},
"name": "Word"
}
},
{
"type": "ExportSpecifier",
"start": 126,
"end": 131,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 7
}
},
"local": {
"type": "Identifier",
"start": 126,
"end": 131,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 7
},
"identifierName": "Apply"
},
"name": "Apply"
},
"exported": {
"type": "Identifier",
"start": 126,
"end": 131,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 7
},
"identifierName": "Apply"
},
"name": "Apply"
}
},
{
"type": "ExportSpecifier",
"start": 135,
"end": 140,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 7
}
},
"local": {
"type": "Identifier",
"start": 135,
"end": 140,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 7
},
"identifierName": "Regex"
},
"name": "Regex"
},
"exported": {
"type": "Identifier",
"start": 135,
"end": 140,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 7
},
"identifierName": "Regex"
},
"name": "Regex"
}
}
],
"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": "Eggvm",
"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": "./eggvm.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": "Value",
"start": 45,
"end": 50,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 50,
"end": 51,
"loc": {
"start": {
"line": 2,
"column": 14
},
"end": {
"line": 2,
"column": 15
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Word",
"start": 52,
"end": 56,
"loc": {
"start": {
"line": 2,
"column": 16
},
"end": {
"line": 2,
"column": 20
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 56,
"end": 57,
"loc": {
"start": {
"line": 2,
"column": 20
},
"end": {
"line": 2,
"column": 21
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Apply",
"start": 58,
"end": 63,
"loc": {
"start": {
"line": 2,
"column": 22
},
"end": {
"line": 2,
"column": 27
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 63,
"end": 64,
"loc": {
"start": {
"line": 2,
"column": 27
},
"end": {
"line": 2,
"column": 28
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Regex",
"start": 65,
"end": 70,
"loc": {
"start": {
"line": 2,
"column": 29
},
"end": {
"line": 2,
"column": 34
}
}
},
{
"type": {
"label": "}",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 71,
"end": 72,
"loc": {
"start": {
"line": 2,
"column": 35
},
"end": {
"line": 2,
"column": 36
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "from",
"start": 73,
"end": 77,
"loc": {
"start": {
"line": 2,
"column": 37
},
"end": {
"line": 2,
"column": 41
}
}
},
{
"type": {
"label": "string",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "./ast.js",
"start": 78,
"end": 88,
"loc": {
"start": {
"line": 2,
"column": 42
},
"end": {
"line": 2,
"column": 52
}
}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 88,
"end": 89,
"loc": {
"start": {
"line": 2,
"column": 52
},
"end": {
"line": 2,
"column": 53
}
}
},
{
"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": 91,
"end": 97,
"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": 98,
"end": 99,
"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": "Eggvm",
"start": 100,
"end": 105,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 14
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 105,
"end": 106,
"loc": {
"start": {
"line": 4,
"column": 14
},
"end": {
"line": 4,
"column": 15
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Value",
"start": 109,
"end": 114,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 7
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 114,
"end": 115,
"loc": {
"start": {
"line": 5,
"column": 7
},
"end": {
"line": 5,
"column": 8
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Word",
"start": 118,
"end": 122,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 6
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 122,
"end": 123,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 7
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Apply",
"start": 126,
"end": 131,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 7
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 131,
"end": 132,
"loc": {
"start": {
"line": 7,
"column": 7
},
"end": {
"line": 7,
"column": 8
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Regex",
"start": 135,
"end": 140,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 7
}
}
},
{
"type": {
"label": "}",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 141,
"end": 142,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 9
}
}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 142,
"end": 143,
"loc": {
"start": {
"line": 8,
"column": 9
},
"end": {
"line": 8,
"column": 10
}
}
},
{
"type": {
"label": "eof",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 144,
"end": 144,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 0
}
}
}
]
}