evm2term
Version:
Translates from Egg Virtual Machine (JSON) to a summarized AST term
559 lines • 12 kB
JSON
{
"type": "apply",
"operator": {
"type": "word",
"line": 1,
"col": 1,
"length": 2,
"name": "do"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 3,
"length": 3,
"name": "def"
},
"args": [
{
"type": "word",
"line": 2,
"col": 8,
"length": 1,
"name": "x"
},
{
"type": "apply",
"operator": {
"type": "word",
"length": 5,
"name": "array"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 13,
"length": 5,
"name": "array"
},
"args": [
{
"type": "value",
"value": 1,
"line": 2,
"col": 13,
"length": 1
},
{
"type": "value",
"value": 2,
"line": 2,
"col": 15,
"length": 1
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 20,
"length": 5,
"name": "array"
},
"args": [
{
"type": "value",
"value": 3,
"line": 2,
"col": 20,
"length": 1
},
{
"type": "value",
"value": 4,
"line": 2,
"col": 22,
"length": 1
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 3,
"length": 1,
"name": "="
},
"args": [
{
"type": "property",
"operator": {
"type": "word",
"line": 3,
"col": 5,
"length": 1,
"name": "x"
},
"args": [
{
"type": "value",
"value": 0,
"line": 3,
"col": 7,
"length": 1
}
]
},
{
"type": "value",
"value": 9,
"line": 3,
"col": 11,
"length": 1
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 3,
"length": 5,
"name": "print"
},
"args": [
{
"type": "word",
"line": 4,
"col": 9,
"length": 1,
"name": "x"
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 6,
"col": 3,
"length": 3,
"name": "def"
},
"args": [
{
"type": "word",
"line": 6,
"col": 7,
"length": 1,
"name": "y"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 6,
"col": 10,
"length": 3,
"name": "map"
},
"args": [
{
"type": "value",
"value": "x",
"line": 6,
"col": 14,
"length": 1,
"raw": "\"x\""
},
{
"type": "value",
"value": 4,
"line": 6,
"col": 16,
"length": 1
},
{
"type": "value",
"value": "y",
"line": 6,
"col": 19,
"length": 1,
"raw": "\"y\""
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 6,
"col": 22,
"length": 5,
"name": "array"
},
"args": [
{
"type": "value",
"value": 0,
"line": 6,
"col": 28,
"length": 1
},
{
"type": "value",
"value": 7,
"line": 6,
"col": 30,
"length": 1
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 7,
"col": 3,
"length": 1,
"name": "="
},
"args": [
{
"type": "property",
"operator": {
"type": "property",
"operator": {
"type": "word",
"line": 7,
"col": 5,
"length": 1,
"name": "y"
},
"args": [
{
"type": "value",
"value": "y",
"line": 7,
"col": 7,
"length": 3,
"raw": "\"y\""
}
]
},
"args": [
{
"type": "value",
"value": 1,
"line": 7,
"col": 12,
"length": 1
}
]
},
{
"type": "value",
"value": 9,
"line": 7,
"col": 16,
"length": 1
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 8,
"col": 3,
"length": 5,
"name": "print"
},
"args": [
{
"type": "property",
"operator": {
"type": "word",
"line": 8,
"col": 9,
"length": 1,
"name": "y"
},
"args": [
{
"type": "value",
"value": "y",
"line": 8,
"col": 11,
"length": 3,
"raw": "\"y\""
},
{
"type": "value",
"value": 1,
"line": 8,
"col": 16,
"length": 1
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 9,
"col": 3,
"length": 5,
"name": "print"
},
"args": [
{
"type": "word",
"line": 9,
"col": 9,
"length": 1,
"name": "y"
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 11,
"col": 3,
"length": 3,
"name": "def"
},
"args": [
{
"type": "word",
"line": 11,
"col": 7,
"length": 1,
"name": "z"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 11,
"col": 12,
"length": 5,
"name": "object"
},
"args": [
{
"type": "value",
"value": "c",
"line": 11,
"col": 12,
"length": 1,
"raw": "\"c\""
},
{
"type": "value",
"value": 4,
"line": 11,
"col": 14,
"length": 1
},
{
"type": "value",
"value": "g",
"line": 11,
"col": 17,
"length": 1,
"raw": "\"g\""
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 11,
"col": 20,
"length": 3,
"name": "fun"
},
"args": [
{
"type": "word",
"line": 11,
"col": 24,
"length": 1,
"name": "a"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 11,
"col": 27,
"length": 1,
"name": "="
},
"args": [
{
"type": "property",
"operator": {
"type": "word",
"line": 11,
"col": 29,
"length": 4,
"name": "self"
},
"args": [
{
"type": "value",
"value": "c",
"line": 11,
"col": 34,
"length": 1,
"raw": "\"c\""
}
]
},
{
"type": "word",
"line": 11,
"col": 37,
"length": 1,
"name": "a"
}
]
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 12,
"col": 3,
"length": 5,
"name": "print"
},
"args": [
{
"type": "property",
"operator": {
"type": "word",
"line": 12,
"col": 9,
"length": 1,
"name": "z"
},
"args": [
{
"type": "value",
"value": "c",
"line": 12,
"col": 11,
"length": 1,
"raw": "\"c\""
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 13,
"col": 3,
"length": 5,
"name": "print"
},
"args": [
{
"type": "apply",
"operator": {
"type": "property",
"operator": {
"type": "word",
"line": 13,
"col": 9,
"length": 1,
"name": "z"
},
"args": [
{
"type": "value",
"value": "g",
"line": 13,
"col": 11,
"length": 1,
"raw": "\"g\""
}
]
},
"args": [
{
"type": "value",
"value": 8,
"line": 13,
"col": 13,
"length": 1
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 14,
"col": 3,
"length": 5,
"name": "print"
},
"args": [
{
"type": "property",
"operator": {
"type": "word",
"line": 14,
"col": 9,
"length": 1,
"name": "z"
},
"args": [
{
"type": "value",
"value": "c",
"line": 14,
"col": 11,
"length": 1,
"raw": "\"c\""
}
]
}
]
}
]
}