UNPKG

evm2term

Version:

Translates from Egg Virtual Machine (JSON) to a summarized AST term

477 lines 11.5 kB
{ "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": "x" }, { "type": "apply", "operator": { "type": "word", "line": 2, "col": 10, "length": 6, "name": "object" }, "args": [ { "type": "value", "value": "c", "line": 3, "col": 5, "length": 3, "raw": "\"c\"" }, { "type": "value", "value": 0, "line": 3, "col": 10, "length": 1 }, { "type": "value", "value": "gc", "line": 4, "col": 5, "length": 4, "raw": "\"gc\"" }, { "type": "apply", "operator": { "type": "word", "line": 4, "col": 12, "length": 3, "name": "fun" }, "args": [ { "type": "apply", "operator": { "type": "word", "line": 4, "col": 16, "length": 7, "name": "element" }, "args": [ { "type": "word", "line": 4, "col": 24, "length": 4, "name": "self" }, { "type": "value", "value": "c", "line": 4, "col": 30, "length": 3, "raw": "\"c\"" } ] } ] }, { "type": "value", "value": "sc", "line": 5, "col": 5, "length": 4, "raw": "\"sc\"" }, { "type": "apply", "operator": { "type": "word", "line": 5, "col": 12, "length": 3, "name": "fun" }, "args": [ { "type": "word", "line": 5, "col": 16, "length": 5, "name": "value" }, { "type": "apply", "operator": { "type": "word", "line": 5, "col": 23, "length": 1, "name": "=" }, "args": [ { "type": "property", "operator": { "type": "word", "line": 5, "col": 25, "length": 4, "name": "self" }, "args": [ { "type": "value", "value": "c", "line": 5, "col": 30, "length": 1, "raw": "\"c\"" } ] }, { "type": "word", "line": 5, "col": 33, "length": 5, "name": "value" } ] } ] }, { "type": "value", "value": "inc", "line": 6, "col": 5, "length": 5, "raw": "\"inc\"" }, { "type": "apply", "operator": { "type": "word", "line": 6, "col": 12, "length": 3, "name": "fun" }, "args": [ { "type": "apply", "operator": { "type": "word", "line": 6, "col": 16, "length": 1, "name": "=" }, "args": [ { "type": "property", "operator": { "type": "word", "line": 6, "col": 18, "length": 4, "name": "self" }, "args": [ { "type": "value", "value": "c", "line": 6, "col": 23, "length": 1, "raw": "\"c\"" } ] }, { "type": "apply", "operator": { "type": "word", "line": 6, "col": 26, "length": 1, "name": "+" }, "args": [ { "type": "property", "operator": { "type": "word", "line": 6, "col": 28, "length": 4, "name": "self" }, "args": [ { "type": "value", "value": "c", "line": 6, "col": 33, "length": 1, "raw": "\"c\"" } ] }, { "type": "value", "value": 1, "line": 6, "col": 36, "length": 1 } ] } ] } ] } ] } ] }, { "type": "apply", "operator": { "type": "word", "line": 8, "col": 3, "length": 5, "name": "print" }, "args": [ { "type": "word", "line": 8, "col": 9, "length": 1, "name": "x" } ] }, { "type": "apply", "operator": { "type": "word", "line": 9, "col": 3, "length": 5, "name": "print" }, "args": [ { "type": "apply", "operator": { "type": "property", "operator": { "type": "word", "line": 9, "col": 9, "length": 1, "name": "x" }, "args": [ { "type": "value", "value": "gc", "line": 9, "col": 11, "length": 2, "raw": "\"gc\"" } ] }, "args": [] } ] }, { "type": "apply", "operator": { "type": "property", "operator": { "type": "word", "line": 10, "col": 3, "length": 1, "name": "x" }, "args": [ { "type": "value", "value": "sc", "line": 10, "col": 5, "length": 2, "raw": "\"sc\"" } ] }, "args": [ { "type": "value", "value": 4, "line": 10, "col": 8, "length": 1 } ] }, { "type": "apply", "operator": { "type": "word", "line": 11, "col": 3, "length": 5, "name": "print" }, "args": [ { "type": "apply", "operator": { "type": "property", "operator": { "type": "word", "line": 11, "col": 9, "length": 1, "name": "x" }, "args": [ { "type": "value", "value": "gc", "line": 11, "col": 11, "length": 2, "raw": "\"gc\"" } ] }, "args": [] } ] }, { "type": "apply", "operator": { "type": "property", "operator": { "type": "word", "line": 12, "col": 3, "length": 1, "name": "x" }, "args": [ { "type": "value", "value": "inc", "line": 12, "col": 5, "length": 3, "raw": "\"inc\"" } ] }, "args": [] }, { "type": "apply", "operator": { "type": "word", "line": 13, "col": 3, "length": 5, "name": "print" }, "args": [ { "type": "apply", "operator": { "type": "property", "operator": { "type": "word", "line": 13, "col": 9, "length": 1, "name": "x" }, "args": [ { "type": "value", "value": "gc", "line": 13, "col": 11, "length": 2, "raw": "\"gc\"" } ] }, "args": [] } ] }, { "type": "apply", "operator": { "type": "word", "line": 14, "col": 3, "length": 5, "name": "print" }, "args": [ { "type": "property", "operator": { "type": "word", "line": 14, "col": 9, "length": 1, "name": "x" }, "args": [ { "type": "value", "value": "c", "line": 14, "col": 11, "length": 1, "raw": "\"c\"" } ] } ] } ] }