@@ -0,0 +1,1365 @@
3+Primitive parser engine
5+A core containing numeric parser primitives.
17+ <36.ecc 414.gly 100.xkc 1.ypj %164>
19+------------------------------------------------------------------------
25+Parsing [`++rule`](). Parses a pair of base-16 digits. Used in escapes.
40+ ++ bix (bass 16 (stun [2 2] six))
45+ ~zod/try=> (scan "07" bix:ab)
47+ ~zod/try=> (scan "51" bix:ab)
49+ ~zod/try=> (scan "a3" bix:ab)
52+------------------------------------------------------------------------
58+Parsing [`++rule`](). Parses an atom of [odor]() [`@pE`](), a phrase of two bytes
74+ ++ hif (boss 256 ;~(plug tip tiq (easy ~)))
79+ ~zod/try=> (scan "doznec" hif:ab)
81+ ~zod/try=> (scan "pittyp" hif:ab)
84+------------------------------------------------------------------------
88+Parse two phonetic pairs
90+Parsing [`++rule`](). Parses and unscrambles an atom of odor [@pF](), a phrase
91+of two two-byte pairs that are encoded (and scrambled) phonetically.
107+ |=([a=@ b=@] (wred:un ~(zug mu ~(zag mu [a b]))))
108+ ;~(plug hif ;~(pfix hep hif))
113+ ~zod/try=> (scan "pittyp-pittyp" huf:ab)
115+ ~zod/try=> (scan "tasfyn-partyv" huf:ab)
117+ ~zod/try=> `@ux`(scan "tasfyn-partyv" huf:ab)
120+------------------------------------------------------------------------
124+Parse 8 phonetic bytes
126+Parsing [`++rule`](). Parses an atom of odor [@pG](), a phrase of eight of
132+An atom of odor [`@pG`]()
142+ ++ hyf (bass 0x1.0000.0000 ;~(plug huf ;~(pfix hep huf) (easy ~)))
147+ ~zod/try=> (scan "sondel-forsut-tillyn-nillyt" hyf:ab)
148+ q=365.637.097.828.335.095
149+ ~zod/try=> `@u`~sondel-forsut-tillyn-nillyt
150+ 365.637.097.828.335.095
152+------------------------------------------------------------------------
158+Parsing [`++rule`](). Parses up to five base-32 digits without a leading zero.
163+Up to five [@uv]() (base 64) digits.
173+ ++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
178+ ~zod/try=> (scan "a" pev:ab)
180+ ~zod/try=> (scan "290j" pev:ab)
182+ ~zod/try=> (scan "123456" pev:ab)
185+ ~zod/try=> (scan "090j" pev:ab)
186+ ~ <syntax error at [1 11]>
188+------------------------------------------------------------------------
194+Parsing [`++rule`](). Parses up to five base-64 digits without a leading zero.
199+Up to five [@uw]() (base 64) digits.
209+ ++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
214+ ~zod/try=> (scan "Q" pew:ab)
216+ ~zod/try=> (scan "aQ~9" pew:ab)
218+ ~zod/try=> `@`0waQ~9
220+ ~zod/try=> (scan "123456" pew:ab)
223+ ~zod/try=> (scan "012345" pew:ab)
227+------------------------------------------------------------------------
233+Parsing [`++rule`](). Parses exactly five base-32 digits.
244+ ++ piv (bass 32 (stun [5 5] siv))
249+ ~zod/try=> (scan "10b3l" piv:ab)
251+ ~zod/try=> (scan "1" piv:ab)
255+------------------------------------------------------------------------
261+Parsing [`++rule`](). Parses exactly five base-64 digits.
269+My name henry let's see how fast I can type.
274+ ++ piw (bass 64 (stun [5 5] siw))
279+ ~zod/try=> (scan "2C-pZ" piw:ab)
281+ ~zod/try=> (scan "2" piv:ab)
285+------------------------------------------------------------------------
291+Parsing [`++rule`](). Parses a binary number of up to 4 digits in length without
303+ ++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
308+ ~zod/try=> (scan "1" qeb:ab)
310+ ~zod/try=> (scan "101" qeb:ab)
312+ ~zod/try=> (scan "1111" qeb:ab)
314+ ~zod/try=> (scan "11111" qeb:ab)
317+ ~zod/try=> (scan "01" qeb:ab)
321+------------------------------------------------------------------------
327+Parsing [`++rule`](). Parses a hexadecimal number of up to 4 digits in length
328+without a leading zero.
339+ ++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
344+ ~zod/try=> (scan "ca" qex:ab)
346+ ~zod/try=> (scan "18ac" qex:ab)
348+ ~zod/try=> (scan "18acc" qex:ab)
351+ ~zod/try=> (scan "08ac" qex:ab)
355+------------------------------------------------------------------------
361+Parsing [`++rule`](). Parses exactly four binary digits.
372+ ++ qib (bass 2 (stun [4 4] sib))
377+ ~zod/try=> (scan "0001" qib:ab)
379+ ~zod/try=> (scan "0100" qib:ab)
381+ ~zod/try=> (scan "110" qib:ab)
385+------------------------------------------------------------------------
391+Parsing [`++rule`](). Parses exactly four hexadecimal digits.
402+ ++ qix (bass 16 (stun [4 4] six))
407+ ~zod/try=> (scan "0100" qix:ab)
409+ ~zod/try=> (scan "10ff" qix:ab)
411+ ~zod/try=> (scan "0" qix:ab)
415+------------------------------------------------------------------------
421+Parsing [`++rule`](). Parses the number 1.
432+ ++ seb (cold 1 (just '1'))
437+ ~zod/try=> (scan "1" seb:ab)
439+ ~zod/try=> (scan "0" seb:ab)
440+ ! ~zod/try/~2014.10.23..22.34.21..bfdd/:<[1 1].[1 18]>
442+ ~zod/try=> (scan "2" seb:ab)
443+ ! ~zod/try/~2014.10.23..22.34.29..d399/:<[1 1].[1 18]>
446+------------------------------------------------------------------------
452+Parsing [`++rule`](). Parses a nonzero decimal digit.
463+ ++ sed (cook |=(a=@ (sub a '0')) (shim '1' '9'))
468+ ~zod/try=> (scan "5" sed:ab)
470+ ~zod/try=> (scan "0" sed:ab)
474+------------------------------------------------------------------------
480+Parsing [`++rule`](). Parses a nonzero base-32 digit
491+ ++ sev ;~(pose sed sov)
496+ ~zod/try=> (scan "c" sev:ab)
498+ ~zod/socialnet=> (scan "0" sev:ab)
502+------------------------------------------------------------------------
508+Parsing [`++rule`](). Parses a nonzero base-64 digit
519+ ++ sew ;~(pose sed sow)
524+ ~zod/try=> (scan "M" sew:ab)
526+ ~zod/try=> (scan "0" sew:ab)
530+------------------------------------------------------------------------
536+Parsing [`++rule`](). Parses a nonzero hexadecimal digit.
547+ ++ sex ;~(pose sed sox)
552+ ~zod/try=> (scan "e" sex:ab)
554+ ~zod/try=> (scan "0" sex:ab)
558+------------------------------------------------------------------------
564+Parsing [`++rule`](). Parses a binary digit.
575+ ++ sib (cook |=(a=@ (sub a '0')) (shim '0' '1'))
580+ ~zod/try=> (scan "1" sib:ab)
582+ ~zod/socialnet=> (scan "0" sib:ab)
585+------------------------------------------------------------------------
591+Parsing [`++rule`](). Parses a decimal digit.
602+ ++ sid (cook |=(a=@ (sub a '0')) (shim '0' '9'))
607+ ~zod/try=> (scan "5" sid:ab)
610+------------------------------------------------------------------------
616+Parsing [`++rule`](). Parses a base-32 digit.
627+ ++ siv ;~(pose sid sov)
632+ ~zod/try=> (scan "c" siv:ab)
635+------------------------------------------------------------------------
641+Parsing [`++rule`](). Parses a base-64 digit.
652+ ++ siw ;~(pose sid sow)
657+ ~zod/try=> (scan "M" siw:ab)
660+------------------------------------------------------------------------
666+Parsing [`++rule`](). Parses a hexadecimal digit.
677+ ++ six ;~(pose sid sox)
682+ ~zod/try=> (scan "e" six:ab)
685+------------------------------------------------------------------------
691+Parsing [`++rule`](). Parses a base-32 letter.
702+ ++ sov (cook |=(a=@ (sub a 87)) (shim 'a' 'v'))
707+ ~zod/try=> (scan "c" sov:ab)
710+------------------------------------------------------------------------
716+Parsing [`++rule`](). Parses a base-64 letter/symbol.
728+ (cook |=(a=@ (sub a 87)) (shim 'a' 'z'))
729+ (cook |=(a=@ (sub a 29)) (shim 'A' 'Z'))
730+ (cold 62 (just '-'))
731+ (cold 63 (just '~'))
737+ ~zod/try=> (scan "M" sow:ab)
740+------------------------------------------------------------------------
746+Parsing [`++rule`](). Parses a hexadecimal letter.
757+ ++ sox (cook |=(a=@ (sub a 87)) (shim 'a' 'f'))
762+ ~zod/try=> (scan "e" sox:ab)
765+------------------------------------------------------------------------
771+Parsing [`++rule`](). Parses a decimal number of up to 3 digits without a
783+ ++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
788+ ~zod/try=> (scan "21" ted:ab)
790+ ~zod/try=> (scan "214" ted:ab)
792+ ~zod/try=> (scan "2140" ted:ab)
794+ ~zod/try=> (scan "0" ted:ab)
798+------------------------------------------------------------------------
802+Leading phonetic byte
804+Parsing [`++rule`](). Parses the leading phonetic byte, which represents a
816+ ++ tip (sear |=(a=@ (ins:po a)) til)
821+ ~zod/try=> (scan "doz" tip:ab)
823+ ~zod/try=> (scan "pit" tip:ab)
826+------------------------------------------------------------------------
830+Trailing phonetic syllable
832+Parsing [`++rule`](). Parses the trailing phonetic byte, which represents a
844+ ++ tiq (sear |=(a=@ (ind:po a)) til)
849+ ~zod/try=> (scan "zod" tiq:ab)
851+ ~zod/try=> (scan "nec" tiq:ab)
854+------------------------------------------------------------------------
858+Parse 3 decimal digits
860+Parsing [`++rule`](). Parses exactly three decimal digits.
871+ ++ tid (bass 10 (stun [3 3] sid))
876+ ~zod/try=> (scan "013" tid:ab)
878+ ~zod/try=> (scan "01" tid:ab)
882+------------------------------------------------------------------------
888+Parsing [`++rule`](). Parses exactly three lowercase letters.
899+ ++ til (boss 256 (stun [3 3] low))
904+ ~zod/try=> (scan "mer" til:ab)
906+ ~zod/try=> `@t`(scan "mer" til:ab)
908+ ~zod/try=> (scan "me" til:ab)
912+------------------------------------------------------------------------
916+Parse span characters
918+Parsing rule. Parses characters from an atom of the span odor [`@ta`]().
930+ |=(a=tape (rap 3 ^-((list ,@) a)))
931+ (star ;~(pose nud low hep dot sig cab))
936+ ~zod/try=> `@ta`(scan "asa-lom_tak" urs:ab)
938+ ~zod/try=> `@t`(scan "asa-lom_tak" urs:ab)
941+------------------------------------------------------------------------
947+Parsing rule. Parses all characters of the span odor [`@ta`]() except
960+ |=(a=tape (rap 3 ^-((list ,@) a)))
961+ (star ;~(pose nud low hep dot sig))
966+ ~zod/try=> `@t`(scan "asa-lom.t0k" urt:ab)
969+------------------------------------------------------------------------
973+Parse bas, soq, or bix
975+Parsing rule. Parses an escaped backslash, single quote, or hex pair
987+ ++ voy ;~(pfix bas ;~(pose bas soq bix))
992+ ~zod/try=> (scan "\\0a" voy:ab)
994+ ~zod/try=> (scan "\\'" voy:ab)
997+------------------------------------------------------------------------
1001+Top-level atom parser engine
1003+A core containing top-level atom parsers.
1021+ <14.vpu 414.mof 100.xkc 1.ypj %164>
1023+------------------------------------------------------------------------
1029+Parser modifier. Parses 0 or the sample rule `fel`.
1037+`fel` is a [`rule`]().
1042+ ++ ape |*(fel=_rule ;~(pose (cold 0 (just '0')) fel))
1047+ ~zod/try=> (scan "202" (star (ape:ag (cold 2 (just '2')))))
1050+------------------------------------------------------------------------
1054+Parses binary number
1056+Parsing rule. Parses a binary number without a leading zero.
1067+ ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
1072+ ~zod/try=> (scan "10.0110" bay:ag)
1075+------------------------------------------------------------------------
1081+Parsing rule. Parses a [`@is`](), an IPv6 address.
1092+ ++ bip =+ tod=(ape qex:ab)
1093+ (bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod))))
1098+ ~zod/try=> (scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1099+ q=283.183.420.760.121.105.516.068.864
1100+ ~zod/try=> `@is`(scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1101+ .0.0.ea.3e6c.0.0.0.0
1103+------------------------------------------------------------------------
1107+Parse decimal with dots
1109+Parsing rule. Parses a decimal number that includes dot separators.
1120+ ++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab)))))
1125+ ~zod/try=> (scan "52" dem:ag)
1127+ ~zod/try=> (scan "13.507" dem:ag)
1130+------------------------------------------------------------------------
1134+Parse decimal number
1136+Parsing rule. Parses a decimal number without a leading zero.
1147+ ++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab))))
1152+ ~zod/try=> (scan "52" dim:ag)
1154+ ~zod/try=> (scan "013507" dim:ag)
1158+------------------------------------------------------------------------
1162+Parse decimal with leading `0`
1164+Parsing rule. Parses a decmial number with leading zeroes.
1175+ ++ dum (bass 10 (plus sid:ab))
1180+ ~zod/try=> (scan "52" dum:ag)
1182+ ~zod/try=> (scan "0000052" dum:ag)
1184+ ~zod/try=> (scan "13507" dim:ag)
1187+------------------------------------------------------------------------
1193+Parsing rule. Parses an atom of odor [`@p`](), the phonetic base.
1205+ (bass 0x1.0000.0000.0000.0000 (most doh hyf:ab))
1214+ ~zod/try=> (scan "zod" fed:ag)
1216+ ~zod/try=> (scan "nec" fed:ag)
1218+ ~zod/try=> (scan "sondel" fed:ag)
1220+ ~zod/try=> ~tillyn-nillyt
1222+ ~zod/try=> (scan "tillyn-nillyt" fed:ag)
1224+ ~zod/try=> (scan "tillyn-nillyt-tasfyn-partyv" fed:ag)
1225+ 15.331.165.687.565.582.592
1226+ ~zod/try=> (scan "tillyn-nillyt-tasfyn-partyv--novweb-talrud-talmud-sonfyr" fed:ag)
1227+ 282.810.089.790.159.633.869.501.053.313.363.681.181
1229+------------------------------------------------------------------------
1235+Parsing rule. Parses a hexadecimal number
1246+ ++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
1251+ ~zod/try=> (scan "4" hex:ag)
1253+ ~zod/try=> (scan "1a" hex:ag)
1255+ ~zod/try=> (scan "3.ac8d" hex:ag)
1257+ ~zod/try=> `@ux`(scan "3.ac8d" hex:ag)
1260+------------------------------------------------------------------------
1266+Parsing rule. Parses an IPv4 address.
1277+ ++ lip =+ tod=(ape ted:ab)
1278+ (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
1283+ ~zod/try=> (scan "127.0.0.1" lip:ag)
1285+ ~zod/try=> `@if`(scan "127.0.0.1" lip:ag)
1287+ ~zod/try=> `@if`(scan "8.8.8.8" lip:ag)
1290+------------------------------------------------------------------------
1294+Parse Base-32 with dots
1296+Parsing rule. Parses a Base-32 number with dot separators.
1307+ ++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
1312+ ~zod/try=> (scan "e2.ol4pm" viz:ag)
1315+------------------------------------------------------------------------
1319+Parse base-32 string
1321+Parsing rule. Parses a raw base-32 string.
1332+ ++ vum (bass 32 (plus siv:ab))
1337+ ~zod/try=> (scan "e2ol4pm" vum:ag)
1340+------------------------------------------------------------------------
1346+Parsing rule. Parses a base-64 number.
1357+ ++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
1364+ ~zod/try=> (scan "e2O.l4Xpm" wiz:ag)
1365+ q=61.764.130.813.526