6# 4j: parsing (bases and base digits)
11A core containing numeric parser primitives.
23 <36.ecc 414.gly 100.xkc 1.ypj %164>
25------------------------------------------------------------------------
31Parsing `++rule`. Parses a pair of base-16 digits. Used in escapes.
46 ++ bix (bass 16 (stun [2 2] six))
58------------------------------------------------------------------------
64Parsing `++rule`. Parses an atom of odor `@pE`, a phrase of two bytes
80 ++ hif (boss 256 ;~(plug tip tiq (easy ~)))
85 > (scan "doznec" hif:ab)
87 > (scan "pittyp" hif:ab)
90------------------------------------------------------------------------
94Parse two phonetic pairs
96Parsing `++rule`. Parses and unscrambles an atom of odor @pF, a phrase
97of two two-byte pairs that are encoded (and scrambled) phonetically.
113 |=([a/@ b/@] (wred:un ~(zug mu ~(zag mu [a b]))))
114 ;~(plug hif ;~(pfix hep hif))
119 > (scan "pittyp-pittyp" huf:ab)
121 > (scan "tasfyn-partyv" huf:ab)
123 > `@ux`(scan "tasfyn-partyv" huf:ab)
126------------------------------------------------------------------------
130Parse 8 phonetic bytes
132Parsing `++rule`. Parses an atom of odor @pG, a phrase of eight of
148 ++ hyf (bass 0x1.0000.0000 ;~(plug huf ;~(pfix hep huf) (easy ~)))
153 > (scan "sondel-forsut-tillyn-nillyt" hyf:ab)
154 q=365.637.097.828.335.095
155 > `@u`~sondel-forsut-tillyn-nillyt
156 365.637.097.828.335.095
158------------------------------------------------------------------------
164Parsing `++rule`. Parses up to five base-32 digits without a leading zero.
169Up to five @uv (base 64) digits.
179 ++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
186 > (scan "290j" pev:ab)
188 > (scan "123456" pev:ab)
191 > (scan "090j" pev:ab)
192 ~ <syntax error at [1 11]>
194------------------------------------------------------------------------
200Parsing `++rule`. Parses up to five base-64 digits without a leading zero.
205Up to five @uw (base 64) digits.
215 ++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
222 > (scan "aQ~9" pew:ab)
226 > (scan "123456" pew:ab)
229 > (scan "012345" pew:ab)
233------------------------------------------------------------------------
239Parsing `++rule`. Parses exactly five base-32 digits.
250 ++ piv (bass 32 (stun [5 5] siv))
255 > (scan "10b3l" piv:ab)
261------------------------------------------------------------------------
267Parsing `++rule`. Parses exactly five base-64 digits.
278 ++ piw (bass 64 (stun [5 5] siw))
283 > (scan "2C-pZ" piw:ab)
289------------------------------------------------------------------------
295Parsing `++rule`. Parses a binary number of up to 4 digits in length without
307 ++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
314 > (scan "101" qeb:ab)
316 > (scan "1111" qeb:ab)
318 > (scan "11111" qeb:ab)
325------------------------------------------------------------------------
331Parsing `++rule`. Parses a hexadecimal number of up to 4 digits in length
332without a leading zero.
343 ++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
350 > (scan "18ac" qex:ab)
352 > (scan "18acc" qex:ab)
355 > (scan "08ac" qex:ab)
359------------------------------------------------------------------------
365Parsing `++rule`. Parses exactly four binary digits.
376 ++ qib (bass 2 (stun [4 4] sib))
381 > (scan "0001" qib:ab)
383 > (scan "0100" qib:ab)
385 > (scan "110" qib:ab)
389------------------------------------------------------------------------
395Parsing `++rule`. Parses exactly four hexadecimal digits.
406 ++ qix (bass 16 (stun [4 4] six))
411 > (scan "0100" qix:ab)
413 > (scan "10ff" qix:ab)
419------------------------------------------------------------------------
425Parsing `++rule`. Parses the number 1.
436 ++ seb (cold 1 (just '1'))
444 ! ~zod/try/~2014.10.23..22.34.21..bfdd/:<[1 1].[1 18]>
447 ! ~zod/try/~2014.10.23..22.34.29..d399/:<[1 1].[1 18]>
450------------------------------------------------------------------------
456Parsing `++rule`. Parses a nonzero decimal digit.
467 ++ sed (cook |=(a/@ (sub a '0')) (shim '1' '9'))
478------------------------------------------------------------------------
484Parsing `++rule`. Parses a nonzero base-32 digit
495 ++ sev ;~(pose sed sov)
502 ~zod/socialnet=> (scan "0" sev:ab)
506------------------------------------------------------------------------
512Parsing `++rule`. Parses a nonzero base-64 digit
523 ++ sew ;~(pose sed sow)
534------------------------------------------------------------------------
540Parsing `++rule`. Parses a nonzero hexadecimal digit.
551 ++ sex ;~(pose sed sox)
562------------------------------------------------------------------------
568Parsing `++rule`. Parses a binary digit.
579 ++ sib (cook |=(a/@ (sub a '0')) (shim '0' '1'))
586 ~zod/socialnet=> (scan "0" sib:ab)
589------------------------------------------------------------------------
595Parsing `++rule`. Parses a decimal digit.
606 ++ sid (cook |=(a/@ (sub a '0')) (shim '0' '9'))
614------------------------------------------------------------------------
620Parsing `++rule`. Parses a base-32 digit.
631 ++ siv ;~(pose sid sov)
639------------------------------------------------------------------------
645Parsing `++rule`. Parses a base-64 digit.
656 ++ siw ;~(pose sid sow)
664------------------------------------------------------------------------
670Parsing `++rule`. Parses a hexadecimal digit.
681 ++ six ;~(pose sid sox)
689------------------------------------------------------------------------
695Parsing `++rule`. Parses a base-32 letter.
706 ++ sov (cook |=(a/@ (sub a 87)) (shim 'a' 'v'))
714------------------------------------------------------------------------
720Parsing `++rule`. Parses a base-64 letter/symbol.
732 (cook |=(a/@ (sub a 87)) (shim 'a' 'z'))
733 (cook |=(a/@ (sub a 29)) (shim 'A' 'Z'))
744------------------------------------------------------------------------
750Parsing `++rule`. Parses a hexadecimal letter.
761 ++ sox (cook |=(a/@ (sub a 87)) (shim 'a' 'f'))
769------------------------------------------------------------------------
775Parsing `++rule`. Parses a decimal number of up to 3 digits without a
787 ++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
794 > (scan "214" ted:ab)
796 > (scan "2140" ted:ab)
802------------------------------------------------------------------------
808Parsing `++rule`. Parses the leading phonetic byte, which represents a
820 ++ tip (sear |=(a/@ (ins:po a)) til)
825 > (scan "doz" tip:ab)
827 > (scan "pit" tip:ab)
830------------------------------------------------------------------------
834Trailing phonetic syllable
836Parsing `++rule`. Parses the trailing phonetic byte, which represents a
848 ++ tiq (sear |=(a/@ (ind:po a)) til)
853 > (scan "zod" tiq:ab)
855 > (scan "nec" tiq:ab)
858------------------------------------------------------------------------
862Parse 3 decimal digits
864Parsing `++rule`. Parses exactly three decimal digits.
875 ++ tid (bass 10 (stun [3 3] sid))
880 > (scan "013" tid:ab)
886------------------------------------------------------------------------
892Parsing `++rule`. Parses exactly three lowercase letters.
903 ++ til (boss 256 (stun [3 3] low))
908 > (scan "mer" til:ab)
910 > `@t`(scan "mer" til:ab)
916------------------------------------------------------------------------
922Parsing rule. Parses characters from an atom of the span odor `@ta`.
934 |=(a/tape (rap 3 ^-((list @) a)))
935 (star ;~(pose nud low hep dot sig cab))
940 > `@ta`(scan "asa-lom_tak" urs:ab)
942 > `@t`(scan "asa-lom_tak" urs:ab)
945------------------------------------------------------------------------
951Parsing rule. Parses all characters of the span odor `@ta` except
964 |=(a/tape (rap 3 ^-((list @) a)))
965 (star ;~(pose nud low hep dot sig))
970 > `@t`(scan "asa-lom.t0k" urt:ab)
973------------------------------------------------------------------------
977Parse bas, soq, or bix
979Parsing rule. Parses an escaped backslash, single quote, or hex pair
991 ++ voy ;~(pfix bas ;~(pose bas soq bix))
996 > (scan "\\0a" voy:ab)
998 > (scan "\\'" voy:ab)
1001------------------------------------------------------------------------
1005Top-level atom parser engine
1007A core containing top-level atom parsers.
1025 <14.vpu 414.mof 100.xkc 1.ypj %164>
1027------------------------------------------------------------------------
1033Parser modifier. Parses 0 or the sample rule `fel`.
1046 ++ ape |*(fel/rule ;~(pose (cold 0 (just '0')) fel))
1052 > (scan "202" (star (ape:ag (cold 2 (just '2')))))
1055------------------------------------------------------------------------
1061Parsing rule. Parses a binary number without a leading zero.
1072 ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
1077 > (scan "10.0110" bay:ag)
1080------------------------------------------------------------------------
1086Parsing rule. Parses a `@is`, an IPv6 address.
1097 ++ bip =+ tod=(ape qex:ab)
1098 (bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod))))
1103 > (scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1104 q=283.183.420.760.121.105.516.068.864
1105 > `@is`(scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1106 .0.0.ea.3e6c.0.0.0.0
1108------------------------------------------------------------------------
1112Parse decimal with dots
1114Parsing rule. Parses a decimal number that includes dot separators.
1125 ++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab)))))
1131 > (scan "52" dem:ag)
1133 > (scan "13.507" dem:ag)
1136------------------------------------------------------------------------
1142Parsing rule. Parses a decimal number without a leading zero.
1153 ++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab))))
1158 > (scan "52" dim:ag)
1160 > (scan "013507" dim:ag)
1164------------------------------------------------------------------------
1168Parse decimal with leading `0`
1170Parsing rule. Parses a decmial number with leading zeroes.
1181 ++ dum (bass 10 (plus sid:ab))
1186 > (scan "52" dum:ag)
1188 > (scan "0000052" dum:ag)
1190 > (scan "13507" dim:ag)
1193------------------------------------------------------------------------
1199Parsing rule. Parses an atom of odor `@p`, the phonetic base.
1211 (bass 0x1.0000.0000.0000.0000 (most doh hyf:ab))
1220 > (scan "zod" fed:ag)
1222 > (scan "nec" fed:ag)
1224 > (scan "sondel" fed:ag)
1228 > (scan "tillyn-nillyt" fed:ag)
1230 > (scan "tillyn-nillyt-tasfyn-partyv" fed:ag)
1231 15.331.165.687.565.582.592
1232 > (scan "tillyn-nillyt-tasfyn-partyv--novweb-talrud-talmud-sonfyr" fed:ag)
1233 282.810.089.790.159.633.869.501.053.313.363.681.181
1235------------------------------------------------------------------------
1241Parsing rule. Parses a hexadecimal number
1252 ++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
1259 > (scan "1a" hex:ag)
1261 > (scan "3.ac8d" hex:ag)
1263 > `@ux`(scan "3.ac8d" hex:ag)
1266------------------------------------------------------------------------
1272Parsing rule. Parses an IPv4 address.
1283 ++ lip =+ tod=(ape ted:ab)
1284 (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
1289 > (scan "127.0.0.1" lip:ag)
1291 > `@if`(scan "127.0.0.1" lip:ag)
1293 > `@if`(scan "8.8.8.8" lip:ag)
1296------------------------------------------------------------------------
1300Parse Base-32 with dots
1302Parsing rule. Parses a Base-32 number with dot separators.
1313 ++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
1318 > (scan "e2.ol4pm" viz:ag)
1321------------------------------------------------------------------------
1327Parsing rule. Parses a raw base-32 string.
1338 ++ vum (bass 32 (plus siv:ab))
1343 > (scan "e2ol4pm" vum:ag)
1346------------------------------------------------------------------------
1352Parsing rule. Parses a base-64 number.
1363 ++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
1370 > (scan "e2O.l4Xpm" wiz:ag)
1371 q=61.764.130.813.526
1376Core used to scramble 16-bit atoms
1378A door that contains arms that are used to scramble two atoms, `top`
1379and `bot`. Used especially in the phonetic base to disguise the
1380relationship between a destroyer and its cruiser.
1401 > ~(. mu 0x20e5 0x5901)
1402 <3.sjm [[@ux @ux] <414.hhh 100.xkc 1.ypj %164>]>
1404------------------------------------------------------------------------
1410Produces the cell of `top` and `bot` with `top` scrambled to the result
1411of adding `bot` to `top` modulo 16. Used to scramble the name of a
1427 ++ zag [p=(end 4 1 (add top bot)) q=bot]
1433 > `[@ux @ux]`~(zag mu 0x20e0 0x201)
1436------------------------------------------------------------------------
1440Subtract bottom from top
1442The inverse of `++zag`. Produces the cell of `top` and `bot` with
1443`top` unscrambled. The unscrambled `top` is the sum of the sample `top`
1444and the 16-bit complement of `bot`. Used to unscramble the name of the
1460 ++ zig [p=(end 4 1 (add top (sub 0x1.0000 bot))) q=bot]
1465 > `[@ux @ux]`~(zig mu 0x2f46 0x1042)
1468------------------------------------------------------------------------
1472Concatenate into atom
1474Produces the concatenation of `top` and `bot`. Used to assemble a
1490 ++ zug (mix (lsh 4 1 top) bot)
1495 > `@ux`~(zug mu 0x10e1 0xfa)
1503Digit rendering engine
1505A door containing arms that render digits at bases 10, 16, 32, and
1526 <4.gut [@ud <414.hhh 100.xkc 1.ypj %164>]>
1528------------------------------------------------------------------------
1534Renders a decimal digit as an atom of an ACII byte value.
1555------------------------------------------------------------------------
1561Renders a hexadecimal digit as an atom of an ASCII byte value.
1574 ++ x ?:((gte tig 10) (add tig 87) d)
1584------------------------------------------------------------------------
1590Renders a base-32 digit as an atom of an ASCII byte value.
1601 ++ v ?:((gte tig 10) (add tig 87) d)
1613------------------------------------------------------------------------
1619Renders a base-64 digit as an atom of an ASCII byte value.
1632 ++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x)))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list