evm2term
Version:
Translates from Egg Virtual Machine (JSON) to a summarized AST term
248 lines • 5.71 kB
JSON
{
"type": "apply",
"operator": {
"type": "word",
"line": 1,
"col": 1,
"length": 2,
"name": "do"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 5,
"length": 3,
"name": "def"
},
"args": [
{
"type": "word",
"line": 2,
"col": 9,
"length": 1,
"name": "f"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 12,
"length": 6,
"name": "object"
},
"args": [
{
"type": "value",
"value": "c",
"line": 2,
"col": 19,
"length": 1,
"raw": "\"c\""
},
{
"type": "value",
"value": 9,
"line": 2,
"col": 22,
"length": 1
},
{
"type": "value",
"value": "h",
"line": 2,
"col": 25,
"length": 1,
"raw": "\"h\""
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 28,
"length": 3,
"name": "fun"
},
"args": [
{
"type": "word",
"line": 2,
"col": 32,
"length": 1,
"name": "x"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 35,
"length": 1,
"name": "+"
},
"args": [
{
"type": "word",
"line": 2,
"col": 37,
"length": 1,
"name": "x"
},
{
"type": "property",
"operator": {
"type": "word",
"line": 2,
"col": 39,
"length": 4,
"name": "self"
},
"args": [
{
"type": "value",
"value": "c",
"line": 2,
"col": 44,
"length": 1,
"raw": "\"c\""
}
]
}
]
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 5,
"length": 3,
"name": "def"
},
"args": [
{
"type": "word",
"line": 3,
"col": 9,
"length": 1,
"name": "x"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 12,
"length": 6,
"name": "object"
},
"args": [
{
"type": "value",
"value": "z",
"line": 3,
"col": 19,
"length": 1,
"raw": "\"z\""
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 22,
"length": 5,
"name": "array"
},
"args": [
{
"type": "value",
"value": 4,
"line": 3,
"col": 28,
"length": 1
},
{
"type": "word",
"line": 3,
"col": 30,
"length": 1,
"name": "f"
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 5,
"length": 5,
"name": "print"
},
"args": [
{
"type": "apply",
"operator": {
"type": "property",
"operator": {
"type": "word",
"line": 4,
"col": 11,
"length": 1,
"name": "x"
},
"args": [
{
"type": "value",
"value": "z",
"line": 4,
"col": 13,
"length": 3,
"raw": "\"z\""
},
{
"type": "value",
"value": 1,
"line": 4,
"col": 18,
"length": 1
},
{
"type": "value",
"value": "h",
"line": 4,
"col": 21,
"length": 3,
"raw": "\"h\""
}
]
},
"args": [
{
"type": "value",
"value": 2,
"line": 4,
"col": 26,
"length": 1
}
]
}
]
}
]
}