evm2term
Version:
Translates from Egg Virtual Machine (JSON) to a summarized AST term
222 lines • 5.48 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": 12,
"name": "cylinderArea"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 7,
"length": 3,
"name": "fun"
},
"args": [
{
"type": "word",
"line": 3,
"col": 11,
"length": 1,
"name": "r"
},
{
"type": "word",
"line": 3,
"col": 14,
"length": 1,
"name": "h"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 9,
"length": 1,
"name": "*"
},
"args": [
{
"type": "value",
"value": 2,
"line": 4,
"col": 11,
"length": 1
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 14,
"length": 1,
"name": "*"
},
"args": [
{
"type": "property",
"operator": {
"type": "word",
"line": 4,
"col": 16,
"length": 4,
"name": "Math"
},
"args": [
{
"type": "value",
"value": "PI",
"line": 4,
"col": 21,
"length": 2,
"raw": "\"PI\""
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 25,
"length": 1,
"name": "*"
},
"args": [
{
"type": "word",
"line": 4,
"col": 27,
"length": 1,
"name": "r"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 30,
"length": 1,
"name": "+"
},
"args": [
{
"type": "word",
"line": 4,
"col": 32,
"length": 1,
"name": "r"
},
{
"type": "word",
"line": 4,
"col": 34,
"length": 1,
"name": "h"
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 7,
"col": 5,
"length": 3,
"name": "def"
},
"args": [
{
"type": "word",
"line": 7,
"col": 9,
"length": 3,
"name": "tin"
},
{
"type": "property",
"operator": {
"type": "word",
"line": 7,
"col": 14,
"length": 12,
"name": "cylinderArea"
},
"args": [
{
"type": "value",
"value": 1,
"line": 7,
"col": 27,
"length": 1
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 8,
"col": 5,
"length": 5,
"name": "print"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 8,
"col": 11,
"length": 3,
"name": "tin"
},
"args": [
{
"type": "value",
"value": 2,
"line": 8,
"col": 15,
"length": 1
}
]
}
]
}
]
}