evm2term
Version:
Translates from Egg Virtual Machine (JSON) to a summarized AST term
190 lines • 4.44 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": "i"
},
{
"type": "value",
"value": 1,
"line": 2,
"col": 11,
"length": 1
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 5,
"length": 3,
"name": "def"
},
"args": [
{
"type": "word",
"line": 3,
"col": 9,
"length": 1,
"name": "r"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 12,
"length": 5,
"name": "while"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 18,
"length": 1,
"name": "<"
},
"args": [
{
"type": "word",
"line": 3,
"col": 20,
"length": 1,
"name": "i"
},
{
"type": "value",
"value": 4,
"line": 3,
"col": 22,
"length": 1
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 26,
"length": 2,
"name": "do"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 15,
"length": 5,
"name": "print"
},
"args": [
{
"type": "word",
"line": 4,
"col": 21,
"length": 1,
"name": "i"
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 5,
"col": 15,
"length": 1,
"name": "="
},
"args": [
{
"type": "word",
"line": 5,
"col": 17,
"length": 1,
"name": "i"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 5,
"col": 20,
"length": 1,
"name": "+"
},
"args": [
{
"type": "word",
"line": 5,
"col": 22,
"length": 1,
"name": "i"
},
{
"type": "value",
"value": 1,
"line": 5,
"col": 24,
"length": 1
}
]
}
]
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 9,
"col": 5,
"length": 5,
"name": "print"
},
"args": [
{
"type": "word",
"line": 9,
"col": 11,
"length": 1,
"name": "r"
}
]
}
]
}