evm2term
Version:
Translates from Egg Virtual Machine (JSON) to a summarized AST term
147 lines • 2.98 kB
JSON
{
"type": "apply",
"operator": {
"type": "word",
"line": 1,
"col": 1,
"length": 2,
"name": "do"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 2,
"length": 3,
"name": "def"
},
"args": [
{
"type": "word",
"line": 2,
"col": 6,
"length": 1,
"name": "f"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 9,
"length": 3,
"name": "fun"
},
"args": [
{
"type": "word",
"line": 2,
"col": 13,
"length": 1,
"name": "x"
},
{
"type": "word",
"line": 2,
"col": 15,
"length": 1,
"name": "y"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 18,
"length": 1,
"name": "+"
},
"args": [
{
"type": "word",
"line": 2,
"col": 20,
"length": 1,
"name": "x"
},
{
"type": "word",
"line": 2,
"col": 22,
"length": 1,
"name": "y"
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 2,
"length": 5,
"name": "print"
},
"args": [
{
"type": "property",
"operator": {
"type": "word",
"line": 3,
"col": 8,
"length": 1,
"name": "f"
},
"args": [
{
"type": "value",
"value": "length",
"line": 3,
"col": 10,
"length": 6,
"raw": "\"length\""
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 2,
"length": 5,
"name": "print"
},
"args": [
{
"type": "property",
"operator": {
"type": "word",
"line": 4,
"col": 8,
"length": 1,
"name": "f"
},
"args": [
{
"type": "value",
"value": "numParams",
"line": 4,
"col": 10,
"length": 9,
"raw": "\"numParams\""
}
]
}
]
}
]
}