evm2term
Version:
Translates from Egg Virtual Machine (JSON) to a summarized AST term
254 lines • 5.24 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": "b"
},
{
"type": "value",
"value": 4,
"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": 5,
"name": "state"
},
{
"type": "property",
"operator": {
"type": "word",
"line": 3,
"col": 16,
"length": 2,
"name": "do"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 9,
"length": 5,
"name": "print"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 15,
"length": 1,
"name": "+"
},
"args": [
{
"type": "word",
"line": 4,
"col": 17,
"length": 1,
"name": "b"
},
{
"type": "value",
"value": 1,
"line": 4,
"col": 19,
"length": 1
}
]
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 6,
"col": 5,
"length": 1,
"name": "="
},
"args": [
{
"type": "property",
"operator": {
"type": "property",
"operator": {
"type": "word",
"line": 6,
"col": 7,
"length": 5,
"name": "state"
},
"args": [
{
"type": "value",
"value": "scope",
"line": 6,
"col": 13,
"length": 5,
"raw": "\"scope\""
}
]
},
"args": [
{
"type": "value",
"value": "b",
"line": 6,
"col": 19,
"length": 1,
"raw": "\"b\""
}
]
},
{
"type": "value",
"value": 9,
"line": 6,
"col": 22,
"length": 1
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 7,
"col": 5,
"length": 5,
"name": "print"
},
"args": [
{
"type": "apply",
"operator": {
"type": "property",
"operator": {
"type": "word",
"line": 7,
"col": 11,
"length": 6,
"name": "Object"
},
"args": [
{
"type": "value",
"value": "keys",
"line": 7,
"col": 18,
"length": 4,
"raw": "\"keys\""
}
]
},
"args": [
{
"type": "word",
"line": 7,
"col": 23,
"length": 5,
"name": "state"
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 8,
"col": 5,
"length": 5,
"name": "print"
},
"args": [
{
"type": "property",
"operator": {
"type": "word",
"line": 8,
"col": 11,
"length": 5,
"name": "state"
},
"args": [
{
"type": "value",
"value": "ast",
"line": 8,
"col": 17,
"length": 3,
"raw": "\"ast\""
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 9,
"col": 5,
"length": 4,
"name": "eval"
},
"args": [
{
"type": "word",
"line": 9,
"col": 10,
"length": 5,
"name": "state"
}
]
}
]
}