2title = "4j: Parsing (Bases and Base Digits)"
11A core containing numeric parser primitives.
24 <36.ecc 414.gly 100.xkc 1.ypj %164>
27------------------------------------------------------------------------
33Parsing `++rule`. Parses a pair of base-16 digits. Used in escapes.
46 ++ bix (bass 16 (stun [2 2] six))
60------------------------------------------------------------------------
66Parsing `++rule`. Parses an atom of aura `@pE`, a phrase of two bytes
80 ++ hif (boss 256 ;~(plug tip tiq (easy ~)))
86 > (scan "doznec" hif:ab)
88 > (scan "pittyp" hif:ab)
92------------------------------------------------------------------------
96Parse two phonetic pairs
98Parsing `++rule`. Parses and unscrambles an atom of aura @pF, a phrase
99of 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))
120 > (scan "pittyp-pittyp" huf:ab)
122 > (scan "tasfyn-partyv" huf:ab)
124 > `@ux`(scan "tasfyn-partyv" huf:ab)
128------------------------------------------------------------------------
132Parse 8 phonetic bytes
134Parsing `++rule`. Parses an atom of aura @pG, a phrase of eight of
148 ++ hyf (bass 0x1.0000.0000 ;~(plug huf ;~(pfix hep huf) (easy ~)))
154 > (scan "sondel-forsut-tillyn-nillyt" hyf:ab)
155 q=365.637.097.828.335.095
156 > `@u`~sondel-forsut-tillyn-nillyt
157 365.637.097.828.335.095
160------------------------------------------------------------------------
166Parsing `++rule`. Parses up to five base-32 digits without a leading zero.
170Up to five @uv (base 64) digits.
179 ++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
187 > (scan "290j" pev:ab)
189 > (scan "123456" pev:ab)
192 > (scan "090j" pev:ab)
193 ~ <syntax error at [1 11]>
196------------------------------------------------------------------------
202Parsing `++rule`. Parses up to five base-64 digits without a leading zero.
206Up to five @uw (base 64) digits.
215 ++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
223 > (scan "aQ~9" pew:ab)
227 > (scan "123456" pew:ab)
230 > (scan "012345" pew:ab)
235------------------------------------------------------------------------
241Parsing `++rule`. Parses exactly five base-32 digits.
250 ++ piv (bass 32 (stun [5 5] siv))
256 > (scan "10b3l" piv:ab)
263------------------------------------------------------------------------
269Parsing `++rule`. Parses exactly five base-64 digits.
278 ++ piw (bass 64 (stun [5 5] siw))
284 > (scan "2C-pZ" piw:ab)
292------------------------------------------------------------------------
298Parsing `++rule`. Parses a binary number of up to 4 digits in length without
308 ++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
316 > (scan "101" qeb:ab)
318 > (scan "1111" qeb:ab)
320 > (scan "11111" qeb:ab)
328------------------------------------------------------------------------
334Parsing `++rule`. Parses a hexadecimal number of up to 4 digits in length
335without a leading zero.
344 ++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
352 > (scan "18ac" qex:ab)
354 > (scan "18acc" qex:ab)
357 > (scan "08ac" qex:ab)
362------------------------------------------------------------------------
368Parsing `++rule`. Parses exactly four binary digits.
377 ++ qib (bass 2 (stun [4 4] sib))
383 > (scan "0001" qib:ab)
385 > (scan "0100" qib:ab)
387 > (scan "110" qib:ab)
392------------------------------------------------------------------------
398Parsing `++rule`. Parses exactly four hexadecimal digits.
407 ++ qix (bass 16 (stun [4 4] six))
413 > (scan "0100" qix:ab)
415 > (scan "10ff" qix:ab)
422------------------------------------------------------------------------
428Parsing `++rule`. Parses the number 1.
437 ++ seb (cold 1 (just '1'))
446 ! ~zod/try/~2014.10.23..22.34.21..bfdd/:<[1 1].[1 18]>
449 ! ~zod/try/~2014.10.23..22.34.29..d399/:<[1 1].[1 18]>
453------------------------------------------------------------------------
459Parsing `++rule`. Parses a nonzero decimal digit.
468 ++ sed (cook |=(a/@ (sub a '0')) (shim '1' '9'))
481------------------------------------------------------------------------
487Parsing `++rule`. Parses a nonzero base-32 digit
496 ++ sev ;~(pose sed sov)
504 ~zod/socialnet=> (scan "0" sev:ab)
509------------------------------------------------------------------------
515Parsing `++rule`. Parses a nonzero base-64 digit
524 ++ sew ;~(pose sed sow)
537------------------------------------------------------------------------
543Parsing `++rule`. Parses a nonzero hexadecimal digit.
552 ++ sex ;~(pose sed sox)
565------------------------------------------------------------------------
571Parsing `++rule`. Parses a binary digit.
580 ++ sib (cook |=(a/@ (sub a '0')) (shim '0' '1'))
588 ~zod/socialnet=> (scan "0" sib:ab)
592------------------------------------------------------------------------
598Parsing `++rule`. Parses a decimal digit.
607 ++ sid (cook |=(a/@ (sub a '0')) (shim '0' '9'))
617------------------------------------------------------------------------
623Parsing `++rule`. Parses a base-32 digit.
632 ++ siv ;~(pose sid sov)
642------------------------------------------------------------------------
648Parsing `++rule`. Parses a base-64 digit.
657 ++ siw ;~(pose sid sow)
667------------------------------------------------------------------------
673Parsing `++rule`. Parses a hexadecimal digit.
682 ++ six ;~(pose sid sox)
692------------------------------------------------------------------------
698Parsing `++rule`. Parses a base-32 letter.
707 ++ sov (cook |=(a/@ (sub a 87)) (shim 'a' 'v'))
716------------------------------------------------------------------------
722Parsing `++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'))
746------------------------------------------------------------------------
752Parsing `++rule`. Parses a hexadecimal letter.
761 ++ sox (cook |=(a/@ (sub a 87)) (shim 'a' 'f'))
771------------------------------------------------------------------------
777Parsing `++rule`. Parses a decimal number of up to 3 digits without a
787 ++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
795 > (scan "214" ted:ab)
797 > (scan "2140" ted:ab)
804------------------------------------------------------------------------
810Parsing `++rule`. Parses the leading phonetic byte, which represents a
820 ++ tip (sear |=(a/@ (ins:po a)) til)
826 > (scan "doz" tip:ab)
829 > (scan "pit" tip:ab)
833------------------------------------------------------------------------
837Trailing phonetic syllable
839Parsing `++rule`. Parses the trailing phonetic byte, which represents a
849 ++ tiq (sear |=(a/@ (ind:po a)) til)
855 > (scan "zod" tiq:ab)
857 > (scan "nec" tiq:ab)
861------------------------------------------------------------------------
865Parse 3 decimal digits
867Parsing `++rule`. Parses exactly three decimal digits.
876 ++ tid (bass 10 (stun [3 3] sid))
882 > (scan "013" tid:ab)
889------------------------------------------------------------------------
895Parsing `++rule`. Parses exactly three lowercase letters.
904 ++ til (boss 256 (stun [3 3] low))
910 > (scan "mer" til:ab)
912 > `@t`(scan "mer" til:ab)
919------------------------------------------------------------------------
925Parsing rule. Parses characters from an atom of the span aura `@ta`.
935 |=(a/tape (rap 3 ^-((list @) a)))
936 (star ;~(pose nud low hep dot sig cab))
942 > `@ta`(scan "asa-lom_tak" urs:ab)
944 > `@t`(scan "asa-lom_tak" urs:ab)
948------------------------------------------------------------------------
954Parsing rule. Parses all characters of the span aura `@ta` except
965 |=(a/tape (rap 3 ^-((list @) a)))
966 (star ;~(pose nud low hep dot sig))
972 > `@t`(scan "asa-lom.t0k" urt:ab)
976------------------------------------------------------------------------
980Parse bas, soq, or bix
982Parsing rule. Parses an escaped backslash, single quote, or hex pair
992 ++ voy ;~(pfix bas ;~(pose bas soq bix))
998 > (scan "\\0a" voy:ab)
1000 > (scan "\\'" voy:ab)
1004------------------------------------------------------------------------
1008Top-level atom parser engine
1010A core containing top-level atom parsers.
1027 <14.vpu 414.mof 100.xkc 1.ypj %164>
1030------------------------------------------------------------------------
1036Parser modifier. Parses 0 or the sample rule `fel`.
1047 ++ ape |*(fel/rule ;~(pose (cold 0 (just '0')) fel))
1053 > (scan "202" (star (ape:ag (cold 2 (just '2')))))
1057------------------------------------------------------------------------
1063Parsing rule. Parses a binary number without a leading zero.
1072 ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
1078 > (scan "10.0110" bay:ag)
1082------------------------------------------------------------------------
1088Parsing 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))))
1104 > (scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1105 q=283.183.420.760.121.105.516.068.864
1106 > `@is`(scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1107 .0.0.ea.3e6c.0.0.0.0
1110------------------------------------------------------------------------
1114Parse decimal with dots
1116Parsing 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)
1137------------------------------------------------------------------------
1143Parsing rule. Parses a decimal number without a leading zero.
1152 ++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab))))
1158 > (scan "52" dim:ag)
1160 > (scan "013507" dim:ag)
1165------------------------------------------------------------------------
1169Parse decimal with leading `0`
1171Parsing rule. Parses a decmial number with leading zeroes.
1180 ++ dum (bass 10 (plus sid:ab))
1186 > (scan "52" dum:ag)
1188 > (scan "0000052" dum:ag)
1190 > (scan "13507" dim:ag)
1194------------------------------------------------------------------------
1200Parsing rule. Parses an atom of aura `@p`, the phonetic base.
1210 (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
1236------------------------------------------------------------------------
1242Parsing rule. Parses a hexadecimal number
1251 ++ 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)
1267------------------------------------------------------------------------
1273Parsing rule. Parses an IPv4 address.
1282 ++ lip =+ tod=(ape ted:ab)
1283 (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)
1297------------------------------------------------------------------------
1301Parse Base-32 with dots
1303Parsing rule. Parses a Base-32 number with dot separators.
1312 ++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
1318 > (scan "e2.ol4pm" viz:ag)
1322------------------------------------------------------------------------
1328Parsing rule. Parses a raw base-32 string.
1337 ++ vum (bass 32 (plus siv:ab))
1343 > (scan "e2ol4pm" vum:ag)
1347------------------------------------------------------------------------
1353Parsing rule. Parses a base-64 number.
1362 ++ 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
1377Core used to scramble 16-bit atoms
1379A door that contains arms that are used to scramble two atoms, `top`
1380and `bot`. Used especially in the phonetic base to disguise the
1381relationship between a planet and its star.
1401 > ~(. mu 0x20e5 0x5901)
1402 <3.sjm [[@ux @ux] <414.hhh 100.xkc 1.ypj %164>]>
1405------------------------------------------------------------------------
1411Produces the cell of `top` and `bot` with `top` scrambled to the result
1412of adding `bot` to `top` modulo 16. Used to scramble the name of a
1426 ++ zag [p=(end 4 1 (add top bot)) q=bot]
1432 > `[@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
1458 ++ zig [p=(end 4 1 (add top (sub 0x1.0000 bot))) q=bot]
1464 > `[@ux @ux]`~(zig mu 0x2f46 0x1042)
1468------------------------------------------------------------------------
1472Concatenate into atom
1474Produces the concatenation of `top` and `bot`. Used to assemble a
1488 ++ zug (mix (lsh 4 1 top) bot)
1494 > `@ux`~(zug mu 0x10e1 0xfa)
1502Digit rendering engine
1504A door containing arms that render digits at bases 10, 16, 32, and
1524 <4.gut [@ud <414.hhh 100.xkc 1.ypj %164>]>
1527------------------------------------------------------------------------
1533Renders a decimal digit as an atom of an ACII byte value.
1555------------------------------------------------------------------------
1561Renders a hexadecimal digit as an atom of an ASCII byte value.
1572 ++ x ?:((gte tig 10) (add tig 87) d)
1585------------------------------------------------------------------------
1591Renders a base-32 digit as an atom of an ASCII byte value.
1600 ++ v ?:((gte tig 10) (add tig 87) d)
1614------------------------------------------------------------------------
1620Renders a base-64 digit as an atom of an ASCII byte value.
1631 ++ 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