esther-medina-quintero-parser-nearley
Version:
402 lines • 12.6 kB
JSON
{
"type": "apply",
"operator": {
"type": "word",
"offset": 0,
"lineBreaks": 0,
"line": 1,
"col": 1,
"name": "do"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"offset": 6,
"lineBreaks": 0,
"line": 2,
"col": 3,
"name": "define"
},
"args": [
{
"type": "word",
"offset": 13,
"lineBreaks": 0,
"line": 2,
"col": 10,
"name": "sum"
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 34,
"lineBreaks": 0,
"line": 3,
"col": 5,
"name": "fun"
},
"args": [
{
"type": "word",
"offset": 38,
"lineBreaks": 0,
"line": 3,
"col": 9,
"name": "nums"
},
{
"type": "word",
"offset": 44,
"lineBreaks": 0,
"line": 3,
"col": 15,
"name": "other"
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 57,
"lineBreaks": 0,
"line": 4,
"col": 7,
"name": "do"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"offset": 70,
"lineBreaks": 0,
"line": 5,
"col": 10,
"name": "print"
},
"args": [
{
"type": "word",
"offset": 76,
"lineBreaks": 0,
"line": 5,
"col": 16,
"name": "other"
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 93,
"lineBreaks": 0,
"line": 6,
"col": 10,
"name": "define"
},
"args": [
{
"type": "word",
"offset": 100,
"lineBreaks": 0,
"line": 6,
"col": 17,
"name": "i"
},
{
"type": "value",
"value": 0,
"raw": "0"
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 116,
"lineBreaks": 0,
"line": 7,
"col": 10,
"name": "define"
},
"args": [
{
"type": "word",
"offset": 123,
"lineBreaks": 0,
"line": 7,
"col": 17,
"name": "sum"
},
{
"type": "value",
"value": 0,
"raw": "0"
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 141,
"lineBreaks": 0,
"line": 8,
"col": 10,
"name": "while"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"offset": 147,
"lineBreaks": 0,
"line": 8,
"col": 16,
"name": "<"
},
"args": [
{
"type": "word",
"offset": 149,
"lineBreaks": 0,
"line": 8,
"col": 18,
"name": "i"
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 152,
"lineBreaks": 0,
"line": 8,
"col": 21,
"name": "length"
},
"args": [
{
"type": "word",
"offset": 159,
"lineBreaks": 0,
"line": 8,
"col": 28,
"name": "nums"
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 178,
"lineBreaks": 0,
"line": 9,
"col": 12,
"name": "do"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"offset": 181,
"lineBreaks": 0,
"line": 9,
"col": 15,
"name": "define"
},
"args": [
{
"type": "word",
"offset": 188,
"lineBreaks": 0,
"line": 9,
"col": 22,
"name": "sum"
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 193,
"lineBreaks": 0,
"line": 9,
"col": 27,
"name": "+"
},
"args": [
{
"type": "word",
"offset": 195,
"lineBreaks": 0,
"line": 9,
"col": 29,
"name": "sum"
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 200,
"lineBreaks": 0,
"line": 9,
"col": 34,
"name": "element"
},
"args": [
{
"type": "word",
"offset": 208,
"lineBreaks": 0,
"line": 9,
"col": 42,
"name": "nums"
},
{
"type": "word",
"offset": 214,
"lineBreaks": 0,
"line": 9,
"col": 48,
"name": "i"
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 234,
"lineBreaks": 0,
"line": 10,
"col": 15,
"name": "define"
},
"args": [
{
"type": "word",
"offset": 241,
"lineBreaks": 0,
"line": 10,
"col": 22,
"name": "i"
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 244,
"lineBreaks": 0,
"line": 10,
"col": 25,
"name": "+"
},
"args": [
{
"type": "word",
"offset": 246,
"lineBreaks": 0,
"line": 10,
"col": 27,
"name": "i"
},
{
"type": "value",
"value": 1,
"raw": "1"
}
]
}
]
}
]
}
]
},
{
"type": "word",
"offset": 287,
"lineBreaks": 0,
"line": 13,
"col": 10,
"name": "sum"
}
]
}
]
}
]
},
{
"type": "apply",
"operator": {
"type": "word",
"offset": 309,
"lineBreaks": 0,
"line": 17,
"col": 2,
"name": "print"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"offset": 315,
"lineBreaks": 0,
"line": 17,
"col": 8,
"name": "sum"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"offset": 319,
"lineBreaks": 0,
"line": 17,
"col": 12,
"name": "array"
},
"args": [
{
"type": "value",
"value": 1,
"raw": "1"
},
{
"type": "value",
"value": 2,
"raw": "2"
},
{
"type": "value",
"value": 3,
"raw": "3"
}
]
},
{
"type": "value",
"value": 4,
"raw": "4"
}
]
}
]
}
]
}