evm2term
Version:
Translates from Egg Virtual Machine (JSON) to a summarized AST term
276 lines • 6.1 kB
JSON
{
"type": "apply",
"operator": {
"type": "word",
"line": 1,
"col": 1,
"length": 2,
"name": "do"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 3,
"length": 3,
"name": "def"
},
"args": [
{
"type": "word",
"line": 2,
"col": 7,
"length": 1,
"name": "f"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 10,
"length": 3,
"name": "fun"
},
"args": [
{
"type": "word",
"line": 2,
"col": 14,
"length": 1,
"name": "x"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 2,
"col": 17,
"length": 1,
"name": "+"
},
"args": [
{
"type": "word",
"line": 2,
"col": 19,
"length": 1,
"name": "x"
},
{
"type": "value",
"value": 1
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 3,
"length": 3,
"name": "def"
},
"args": [
{
"type": "word",
"line": 3,
"col": 7,
"length": 1,
"name": "g"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 10,
"length": 3,
"name": "fun"
},
"args": [
{
"type": "word",
"line": 3,
"col": 14,
"length": 1,
"name": "x"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 3,
"col": 17,
"length": 1,
"name": "*"
},
"args": [
{
"type": "word",
"line": 3,
"col": 19,
"length": 1,
"name": "x"
},
{
"type": "value",
"value": 2
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 3,
"length": 3,
"name": "def"
},
"args": [
{
"type": "word",
"line": 4,
"col": 7,
"length": 2,
"name": "**"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 11,
"length": 3,
"name": "fun"
},
"args": [
{
"type": "word",
"line": 4,
"col": 15,
"length": 7,
"name": "lambda1"
},
{
"type": "word",
"line": 4,
"col": 24,
"length": 7,
"name": "lambda2"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 33,
"length": 3,
"name": "fun"
},
"args": [
{
"type": "word",
"line": 4,
"col": 37,
"length": 1,
"name": "z"
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 40,
"length": 7,
"name": "lambda1"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"line": 4,
"col": 48,
"length": 7,
"name": "lambda2"
},
"args": [
{
"type": "word",
"line": 4,
"col": 56,
"length": 1,
"name": "z"
}
]
}
]
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"line": 8,
"col": 3,
"length": 5,
"name": "print"
},
"args": [
{
"type": "apply",
"operator": {
"type": "apply",
"operator": {
"type": "word",
"line": 8,
"col": 9,
"length": 2,
"name": "**"
},
"args": [
{
"type": "word",
"line": 8,
"col": 12,
"length": 1,
"name": "g"
},
{
"type": "word",
"line": 8,
"col": 14,
"length": 1,
"name": "f"
}
]
},
"args": [
{
"type": "value",
"value": 8
}
]
}
]
}
]
}