evm2term
Version:
Translates from Egg Virtual Machine (JSON) to a summarized AST term
159 lines • 3.22 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": 7,
"length": 1,
"name": "x"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 10,
"length": 3,
"name": "arr"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 14,
"length": 3,
"name": "arr"
},
"args": [
{
"type": "value",
"value": 1,
"line": 2,
"col": 18,
"length": 1
},
{
"type": "value",
"value": 4,
"line": 2,
"col": 20,
"length": 1
}
]
},
{
"type": "value",
"value": 5,
"line": 2,
"col": 23,
"length": 1
},
{
"type": "value",
"value": 7,
"line": 2,
"col": 25,
"length": 1
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 3,
"length": 5,
"name": "print"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 9,
"length": 7,
"name": "element"
},
"args": [
{
"type": "word",
"line": 3,
"col": 17,
"length": 1,
"name": "x"
},
{
"type": "value",
"value": 0,
"line": 3,
"col": 19,
"length": 1
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 3,
"length": 5,
"name": "print"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 9,
"length": 7,
"name": "element"
},
"args": [
{
"type": "word",
"line": 4,
"col": 17,
"length": 1,
"name": "x"
},
{
"type": "value",
"value": 1,
"line": 4,
"col": 19,
"length": 1
}
]
}
]
}
]
}