tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

parser-demo.json (20389B)


      1 {
      2   "id": "parser",
      3   "source": "!import 6aa33a710955e5746f322775b9078f57ba4145f6b723ff4b76a292285e919823 *\n!import 14282088469cc420dd014700da06998f6bb8dcf990fc885a464c0a1e1858e20d *\n!import 7f87549d587fa8c3be88af0ea988db3adcc3b35f1ffb48973553491b075614db as N\n!export parseNames\n!export parsePrefix\n\n-- Lowercase names separated by commas. Try \"red,green\", \"red,,blue\",\n-- \"red,\" and \"red green\". A comma commits to another name.\n-- parseNames requires the entire input; parsePrefix exposes any remainder.\n-- Edit the parser or labels below; valid edits compile locally.\n-- Imports pin complete library interfaces, fetched only when compiling.\nnameParser = parserLabel \"lowercase name\" (parserSome (parserSatisfy (c : N.inRange c 97 122)))\ncommaParser = parserThen (parserExpect 44) parserCommit\nnamesPrefix = parserSepBy1 nameParser commaParser\nnamesComplete = parserBefore namesPrefix (parserLabel \"end of input\" parserEof)\n\nreport reply = (parserMatchReply\n  (diagnostic rest consumed committed : [\n    [\"status\" 0 \"error\"]\n    [\"expected\" 0 (parserDiagnosticExpected diagnostic)]\n    [\"remaining\" 0 rest]\n    [\"consumed\" 2 consumed]\n    [\"committed\" 2 committed]])\n  (names rest consumed committed : [\n    [\"status\" 0 \"ok\"]\n    [\"names\" 0 (intercalate \", \" names)]\n    [\"count\" 1 (length names)]\n    [\"remaining\" 0 rest]\n    [\"consumed\" 2 consumed]\n    [\"committed\" 2 committed]])\n  reply)\nparseNames text = report (namesComplete text)\nparsePrefix text = report (namesPrefix text)\n",
      4   "hash": "355e41506f39e05da8c8a72a68aa810a486e062480322bac11af67e86980520e",
      5   "mode": "pure",
      6   "compilerSha256": "d70de875988dfa309f2c167992928866f88b08af351918b8c7b5d88c541c6e94",
      7   "sourceSha256": "18aa0a464dabb595749abdab5edb1bb11c4356c0e753cf0985a644901bb5c241",
      8   "haskellCases": [
      9     {
     10       "export": "parseNames",
     11       "arguments": [
     12         "220210202021021021002210202102020210210022020210202021021002202021021020210022102102102020210210022021020202102102100221020210202021021002210202102020210210022021021021020210210022020210210202100220210202020210210022020210210202102100221020210202102102100221020210202021021000"
     13       ],
     14       "input": null,
     15       "terminal": "",
     16       "result": "22221021020202102102100220202102021021021002210202020202102100220202102021021021002210202102021021021002210210202021021021000202221021021021020210210022102102021020210210000222202102102102021021002210202020202102100221020210210202102100221020210202021021002210210202021021021000202220210202021021021002210202102020210210022020210202021021002202021021020210022020202020210022102102102020210210022021020202102102100221020210202021021002210202102020210210022021021021020210210022020210210202100220202020202100220210202020210210022020210210202102100221020210202102102100221020210202021021000022221021020202021021002210210210210202102100221020210202102102100220210210210202102100220202102021021021000221002210210002222021020202102102100221020210202021021002210202102102021021002210202020202102100221020202102021021002202102102102021021002210202021020210210022021021021020210210022102102102020210210002020022221021020202021021002210210210210202102100220210210210202102100221021020202102102100221020210202102102100221020210210202102100221020210202021021002202021020202102100022021002100222210210202020210210022102102102102021021002210202102102021021002210202102102021021002210202021020210210022020210202102102100220202102021021021002210202102020210210022020210202021021000220210021000",
     17       "record": {
     18         "status": "ok",
     19         "names": "red, green, blue",
     20         "count": 3,
     21         "remaining": "",
     22         "consumed": true,
     23         "committed": true
     24       }
     25     },
     26     {
     27       "export": "parseNames",
     28       "arguments": [
     29         "220210202021021021002210202102020210210022020210202021021000"
     30       ],
     31       "input": null,
     32       "terminal": "",
     33       "result": "2222102102020210210210022020210202102102100221020202020210210022020210202102102100221020210202102102100221021020202102102100020222102102102102021021002210210202102021021000022220210210210202102100221020202020210210022102021021020210210022102021020202102100221021020202102102100020222021020202102102100221020210202021021002202021020202102100002222102102020202102100221021021021020210210022102021020210210210022021021021020210210022020210202102102100022100221000222202102020210210210022102021020202102100221020210210202102100221020202020210210022102020210202102100220210210210202102100221020202102021021002202102102102021021002210210210202021021000202002222102102020202102100221021021021020210210022021021021020210210022102102020210210210022102021020210210210022102021021020210210022102021020202102100220202102020210210002202100210022221021020202021021002210210210210202102100221020210210202102100221020210210202102100221020202102021021002202021020210210210022020210202102102100221020210202021021002202021020202102100022021002000",
     34       "record": {
     35         "status": "ok",
     36         "names": "red",
     37         "count": 1,
     38         "remaining": "",
     39         "consumed": true,
     40         "committed": false
     41       }
     42     },
     43     {
     44       "export": "parseNames",
     45       "arguments": [
     46         "220210202021021021002210202102020210210022020210202021021002202021021020210022020210210202100220210202020210210022020210210202102100221020210202102102100221020210202021021000"
     47       ],
     48       "input": null,
     49       "terminal": "",
     50       "result": "22221021020202102102100220202102021021021002210202020202102100220202102021021021002210202102021021021002210210202021021021000202221020210202021021002202102020210210210022021020202102102100221021021021020210210022021020202102102100002222102021020202102100220202021021021021002202020202102102100221020210202021021002210210202020210210022020210202102102100221020210202021021002202021020202102100020222020210210202102100221021021021020210210022102102102021021021002210202102020210210022021020202102102100221021020202021021002210202020202102100221021020202102102100221020210202021021002202020202021002202102102102021021002210202020202102100221020210210202102100221020210202021021000022220210202021021021002210202102020210210022102021021020210210022102020202021021002210202021020210210022021021021020210210022102020210202102100220210210210202102100221021021020202102100020222020210210202100220210202020210210022020210210202102100221020210202102102100221020210202021021000022221021020202021021002210210210210202102100220210210210202102100221021020202102102100221020210202102102100221020210210202102100221020210202021021002202021020202102100022021002100222210210202020210210022102102102102021021002210202102102021021002210202102102021021002210202021020210210022020210202102102100220202102021021021002210202102020210210022020210202021021000220210021000",
     51       "record": {
     52         "status": "error",
     53         "expected": "lowercase name",
     54         "remaining": ",blue",
     55         "consumed": true,
     56         "committed": true
     57       }
     58     },
     59     {
     60       "export": "parseNames",
     61       "arguments": [
     62         "22021020202102102100221020210202021021002202021020202102100220202102102021000"
     63       ],
     64       "input": null,
     65       "terminal": "",
     66       "result": "2222102102020210210210022020210202102102100221020202020210210022020210202102102100221020210202102102100221021020202102102100020222102021020202102100220210202021021021002202102020210210210022102102102102021021002202102020210210210000222210202102020210210022020202102102102100220202020210210210022102021020202102100221021020202021021002202021020210210210022102021020202102100220202102020210210002022202021021020210210022102102102102021021002210210210202102102100221020210202021021002202102020210210210022102102020202102100221020202020210210022102102020210210210022102021020202102100220202020202100220210210210202102100221020202020210210022102021021020210210022102021020202102100002222021020202102102100221020210202021021002210202102102021021002210202020202102100221020202102021021002202102102102021021002210202021020210210022021021021020210210022102102102020210210002020022221021020202021021002210210210210202102100220210210210202102100221021020202102102100221020210202102102100221020210210202102100221020210202021021002202021020202102100022021002100222210210202020210210022102102102102021021002210202102102021021002210202102102021021002210202021020210210022020210202102102100220202102021021021002210202102020210210022020210202021021000220210021000",
     67       "record": {
     68         "status": "error",
     69         "expected": "lowercase name",
     70         "remaining": "",
     71         "consumed": true,
     72         "committed": true
     73       }
     74     },
     75     {
     76       "export": "parseNames",
     77       "arguments": [
     78         "0"
     79       ],
     80       "input": null,
     81       "terminal": "",
     82       "result": "22221021020202102102100220202102021021021002210202020202102100220202102021021021002210202102021021021002210210202021021021000202221020210202021021002202102020210210210022021020202102102100221021021021020210210022021020202102102100002222102021020202102100220202021021021021002202020202102102100221020210202021021002210210202020210210022020210202102102100221020210202021021002202021020202102100020222020210210202102100221021021021020210210022102102102021021021002210202102020210210022021020202102102100221021020202021021002210202020202102100221021020202102102100221020210202021021002202020202021002202102102102021021002210202020202102100221020210210202102100221020210202021021000022220210202021021021002210202102020210210022102021021020210210022102020202021021002210202021020210210022021021021020210210022102020210202102100220210210210202102100221021021020202102100020200222210210202020210210022102102102102021021002202102102102021021002210210202021021021002210202102021021021002210202102102021021002210202102020210210022020210202021021000220210020022221021020202021021002210210210210202102100221020210210202102100221020210210202102100221020202102021021002202021020210210210022020210202102102100221020210202021021002202021020202102100022021002000",
     83       "record": {
     84         "status": "error",
     85         "expected": "lowercase name",
     86         "remaining": "",
     87         "consumed": false,
     88         "committed": false
     89       }
     90     },
     91     {
     92       "export": "parseNames",
     93       "arguments": [
     94         "22021020202102021002210202102020210210022020210202021021000"
     95       ],
     96       "input": null,
     97       "terminal": "",
     98       "result": "222210210202021021021002202021020210210210022102020202021021002202021020210210210022102021020210210210022102102020210210210002022210202102020210210022021020202102102100220210202021021021002210210210210202102100220210202021021021000022221020210202021021002202020210210210210022020202021021021002210202102020210210022102102020202102100220202102021021021002210202102020210210022020210202021021000202220202102102021021002210210210210202102100221021021020210210210022102021020202102100220210202021021021002210210202020210210022102020202021021002210210202021021021002210202102020210210022020202020210022021021021020210210022102020202021021002210202102102021021002210202102020210210000222202102020210210210022102021020202102100221020210210202102100221020202020210210022102020210202102100220210210210202102100221020202102021021002202102102102021021002210210210202021021000202220210202021020210022102021020202102100220202102020210210000222210210202020210210022102102102102021021002202102102102021021002210210202021021021002210202102021021021002210202102102021021002210202102020210210022020210202021021000220210020022221021020202021021002210210210210202102100221020210210202102100221020210210202102100221020202102021021002202021020210210210022020210202102102100221020210202021021002202021020202102100022021002000",
     99       "record": {
    100         "status": "error",
    101         "expected": "lowercase name",
    102         "remaining": "Red",
    103         "consumed": false,
    104         "committed": false
    105       }
    106     },
    107     {
    108       "export": "parseNames",
    109       "arguments": [
    110         "220210202021021021002210202102020210210022020210202021021002202020202021002210210210202021021002202102020210210210022102021020202102100221020210202021021002202102102102021021000"
    111       ],
    112       "input": null,
    113       "terminal": "",
    114       "result": "2222102102020210210210022020210202102102100221020202020210210022020210202102102100221020210202102102100221021020202102102100020222102021020202102100220210202021021021002202102020210210210022102102102102021021002202102020210210210000222210202102020210210022020202102102102100220202020210210210022102021020202102100221021020202021021002202021020210210210022102021020202102100220202102020210210002022210202102020210210022021021021020210210022020210202021021002202020202021002210210210210202102100220210210202021021002202020202021002210202021020210210022021021021020210210022020202021021021002210202102021021021002202021020210210210000222202102020210210210022102021020202102100221020210210202102100221020202020210210022102020210202102100220210210210202102100221020202102021021002202102102102021021002210210210202021021000202220202020202100221021021020202102100220210202021021021002210202102020210210022102021020202102100220210210210202102100002222102102020202102100221021021021020210210022021021021020210210022102102020210210210022102021020210210210022102021021020210210022102021020202102100220202102020210210002202100210022221021020202021021002210210210210202102100221020210210202102100221020210210202102100221020202102021021002202021020210210210022020210202102102100221020210202021021002202021020202102100022021002000",
    115       "record": {
    116         "status": "error",
    117         "expected": "end of input",
    118         "remaining": " green",
    119         "consumed": true,
    120         "committed": false
    121       }
    122     },
    123     {
    124       "export": "parseNames",
    125       "arguments": [
    126         "220210202021021021002210202102020210210022020210202021021002202021021020210022102102102020210210022021020202102102100221020210202021021002210202102020210210022021021021020210210022102020202021000"
    127       ],
    128       "input": null,
    129       "terminal": "",
    130       "result": "222210210202021021021002202021020210210210022102020202021021002202021020210210210022102021020210210210022102102020210210210002022210202102020210210022021020202102102100220210202021021021002210210210210202102100220210202021021021000022221020210202021021002202020210210210210022020202021021021002210202102020210210022102102020202102100220202102021021021002210202102020210210022020210202021021000202221020210202021021002202102102102021021002202021020202102100220202020202100221021021021020210210022021021020202102100220202020202100221020202102021021002202102102102021021002202020202102102100221020210202102102100220202102021021021000022220210202021021021002210202102020210210022102021021020210210022102020202021021002210202021020210210022021021021020210210022102020210202102100220210210210202102100221021021020202102100020222102020202021000022221021020202021021002210210210210202102100220210210210202102100221021020202102102100221020210202102102100221020210210202102100221020210202021021002202021020202102100022021002100222210210202020210210022102102102102021021002210202102102021021002210202102102021021002210202021020210210022020210202102102100220202102021021021002210202102020210210022020210202021021000220210021000",
    131       "record": {
    132         "status": "error",
    133         "expected": "end of input",
    134         "remaining": "!",
    135         "consumed": true,
    136         "committed": true
    137       }
    138     },
    139     {
    140       "export": "parsePrefix",
    141       "arguments": [
    142         "220210202021021021002210202102020210210022020210202021021002202020202021002210210210202021021002202102020210210210022102021020202102100221020210202021021002202102102102021021000"
    143       ],
    144       "input": null,
    145       "terminal": "",
    146       "result": "2222102102020210210210022020210202102102100221020202020210210022020210202102102100221020210202102102100221021020202102102100020222102102102102021021002210210202102021021000022220210210210202102100221020202020210210022102021021020210210022102021020202102100221021020202102102100020222021020202102102100221020210202021021002202021020202102100002222102102020202102100221021021021020210210022102021020210210210022021021021020210210022020210202102102100022100221000222202102020210210210022102021020202102100221020210210202102100221020202020210210022102020210202102100220210210210202102100221020202102021021002202102102102021021002210210210202021021000202220202020202100221021021020202102100220210202021021021002210202102020210210022102021020202102100220210210210202102100002222102102020202102100221021021021020210210022021021021020210210022102102020210210210022102021020210210210022102021021020210210022102021020202102100220202102020210210002202100210022221021020202021021002210210210210202102100221020210210202102100221020210210202102100221020202102021021002202021020210210210022020210202102102100221020210202021021002202021020202102100022021002000",
    147       "record": {
    148         "status": "ok",
    149         "names": "red",
    150         "count": 1,
    151         "remaining": " green",
    152         "consumed": true,
    153         "committed": false
    154       }
    155     },
    156     {
    157       "export": "parsePrefix",
    158       "arguments": [
    159         "220210202021021021002210202102020210210022020210202021021002202021021020210022102102102020210210022021020202102102100221020210202021021002210202102020210210022021021021020210210022102020202021000"
    160       ],
    161       "input": null,
    162       "terminal": "",
    163       "result": "2222102102020210210210022020210202102102100221020202020210210022020210202102102100221020210202102102100221021020202102102100020222102102102102021021002210210202102021021000022220210210210202102100221020202020210210022102021021020210210022102021020202102100221021020202102102100020222021020202102102100221020210202021021002202021020202102100220202102102021002202020202021002210210210202021021002202102020210210210022102021020202102100221020210202021021002202102102102021021000022221021020202021021002210210210210202102100221020210202102102100220210210210202102100220202102021021021000221002202100022220210202021021021002210202102020210210022102021021020210210022102020202021021002210202021020210210022021021021020210210022102020210202102100220210210210202102100221021021020202102100020222102020202021000022221021020202021021002210210210210202102100220210210210202102100221021020202102102100221020210202102102100221020210210202102100221020210202021021002202021020202102100022021002100222210210202020210210022102102102102021021002210202102102021021002210202102102021021002210202021020210210022020210202102102100220202102021021021002210202102020210210022020210202021021000220210021000",
    164       "record": {
    165         "status": "ok",
    166         "names": "red, green",
    167         "count": 2,
    168         "remaining": "!",
    169         "consumed": true,
    170         "committed": true
    171       }
    172     },
    173     {
    174       "export": "parsePrefix",
    175       "arguments": [
    176         "22021020202102102100221020210202021021002202021020202102100220202102102021000"
    177       ],
    178       "input": null,
    179       "terminal": "",
    180       "result": "2222102102020210210210022020210202102102100221020202020210210022020210202102102100221020210202102102100221021020202102102100020222102021020202102100220210202021021021002202102020210210210022102102102102021021002202102020210210210000222210202102020210210022020202102102102100220202020210210210022102021020202102100221021020202021021002202021020210210210022102021020202102100220202102020210210002022202021021020210210022102102102102021021002210210210202102102100221020210202021021002202102020210210210022102102020202102100221020202020210210022102102020210210210022102021020202102100220202020202100220210210210202102100221020202020210210022102021021020210210022102021020202102100002222021020202102102100221020210202021021002210202102102021021002210202020202102100221020202102021021002202102102102021021002210202021020210210022021021021020210210022102102102020210210002020022221021020202021021002210210210210202102100220210210210202102100221021020202102102100221020210202102102100221020210210202102100221020210202021021002202021020202102100022021002100222210210202020210210022102102102102021021002210202102102021021002210202102102021021002210202021020210210022020210202102102100220202102021021021002210202102020210210022020210202021021000220210021000",
    181       "record": {
    182         "status": "error",
    183         "expected": "lowercase name",
    184         "remaining": "",
    185         "consumed": true,
    186         "committed": true
    187       }
    188     }
    189   ]
    190 }