1 | /* |
2 | Binding levels (well...): |
3 | 0 = lowest |
4 | 1 = arrows (> lowest) |
5 | 2 = arrowsr (> arrows) |
6 | 3 = word (> arrows) |
7 | 4 = juxta, idword, subword (> word) |
8 | */ |
9 | |
10 | |
11 | static S snlParse_rules = [[ |
12 | // highest (strongest binding) level |
13 | <extidentifier> = idword |
14 | <int> = subword |
15 | <quoted> = subword |
16 | // <ucid> = subword |
17 | |
18 | // random symbols we'd want to use |
19 | // (they don't parse if not listed here) |
20 | ? = symbol |
21 | ! = symbol |
22 | : = symbol |
23 | * = symbol |
24 | "=" = symbol |
25 | + = symbol |
26 | , = symbol |
27 | . = symbol |
28 | <symbol> = idword |
29 | |
30 | <subword> = word |
31 | <idword> = word |
32 | |
33 | // juxtaposition on highest level |
34 | <word> <word> = juxta |
35 | <juxta> = word |
36 | |
37 | // bracketing takes us to highest level |
38 | [ <lowest> ] = square |
39 | ( <lowest> ) = round |
40 | |
41 | <square> = subword |
42 | <round> = subword |
43 | |
44 | // < is intermediate |
45 | <word> = arrowsr |
46 | <word> > <arrowsr> = realarrowr |
47 | <realarrowr> = arrowsr |
48 | |
49 | <arrowsr> < <arrows> = realarrow |
50 | <realarrow> = arrows |
51 | <arrowsr> = arrows |
52 | |
53 | = lowest // allow empty here |
54 | <arrows> = lowest |
55 | ]]; |
56 | |
57 | static Explain snlParse(S input) { |
58 | ret explainFull(snlTok(input), snlParse_rules, "lowest"); |
59 | } |
Began life as a copy of #1002683
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002688 |
Snippet name: | snlParse |
Eternal ID of this version: | #1002688/1 |
Text MD5: | a805797607a5ebd388a912dd1017fd0e |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-02-25 20:25:30 |
Source code size: | 1169 bytes / 59 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 598 / 1148 |
Referenced in: | [show references] |