1# 4j: parsing (bases and base digits)
6A core containing numeric parser primitives.
18 <36.ecc 414.gly 100.xkc 1.ypj %164>
20------------------------------------------------------------------------
26Parsing `++rule`. Parses a pair of base-16 digits. Used in escapes.
41 ++ bix (bass 16 (stun [2 2] six))
53------------------------------------------------------------------------
59Parsing `++rule`. Parses an atom of odor `@pE`, a phrase of two bytes
75 ++ hif (boss 256 ;~(plug tip tiq (easy ~)))
80 > (scan "doznec" hif:ab)
82 > (scan "pittyp" hif:ab)
85------------------------------------------------------------------------
89Parse two phonetic pairs
91Parsing `++rule`. Parses and unscrambles an atom of odor @pF, a phrase
92of two two-byte pairs that are encoded (and scrambled) phonetically.
108 |=([a/@ b/@] (wred:un ~(zug mu ~(zag mu [a b]))))
109 ;~(plug hif ;~(pfix hep hif))
114 > (scan "pittyp-pittyp" huf:ab)
116 > (scan "tasfyn-partyv" huf:ab)
118 > `@ux`(scan "tasfyn-partyv" huf:ab)
121------------------------------------------------------------------------
125Parse 8 phonetic bytes
127Parsing `++rule`. Parses an atom of odor @pG, a phrase of eight of
143 ++ hyf (bass 0x1.0000.0000 ;~(plug huf ;~(pfix hep huf) (easy ~)))
148 > (scan "sondel-forsut-tillyn-nillyt" hyf:ab)
149 q=365.637.097.828.335.095
150 > `@u`~sondel-forsut-tillyn-nillyt
151 365.637.097.828.335.095
153------------------------------------------------------------------------
159Parsing `++rule`. Parses up to five base-32 digits without a leading zero.
164Up to five @uv (base 64) digits.
174 ++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
181 > (scan "290j" pev:ab)
183 > (scan "123456" pev:ab)
186 > (scan "090j" pev:ab)
187 ~ <syntax error at [1 11]>
189------------------------------------------------------------------------
195Parsing `++rule`. Parses up to five base-64 digits without a leading zero.
200Up to five @uw (base 64) digits.
210 ++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
217 > (scan "aQ~9" pew:ab)
221 > (scan "123456" pew:ab)
224 > (scan "012345" pew:ab)
228------------------------------------------------------------------------
234Parsing `++rule`. Parses exactly five base-32 digits.
245 ++ piv (bass 32 (stun [5 5] siv))
250 > (scan "10b3l" piv:ab)
256------------------------------------------------------------------------
262Parsing `++rule`. Parses exactly five base-64 digits.
273 ++ piw (bass 64 (stun [5 5] siw))
278 > (scan "2C-pZ" piw:ab)
284------------------------------------------------------------------------
290Parsing `++rule`. Parses a binary number of up to 4 digits in length without
302 ++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
309 > (scan "101" qeb:ab)
311 > (scan "1111" qeb:ab)
313 > (scan "11111" qeb:ab)
320------------------------------------------------------------------------
326Parsing `++rule`. Parses a hexadecimal number of up to 4 digits in length
327without a leading zero.
338 ++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
345 > (scan "18ac" qex:ab)
347 > (scan "18acc" qex:ab)
350 > (scan "08ac" qex:ab)
354------------------------------------------------------------------------
360Parsing `++rule`. Parses exactly four binary digits.
371 ++ qib (bass 2 (stun [4 4] sib))
376 > (scan "0001" qib:ab)
378 > (scan "0100" qib:ab)
380 > (scan "110" qib:ab)
384------------------------------------------------------------------------
390Parsing `++rule`. Parses exactly four hexadecimal digits.
401 ++ qix (bass 16 (stun [4 4] six))
406 > (scan "0100" qix:ab)
408 > (scan "10ff" qix:ab)
414------------------------------------------------------------------------
420Parsing `++rule`. Parses the number 1.
431 ++ seb (cold 1 (just '1'))
439 ! ~zod/try/~2014.10.23..22.34.21..bfdd/:<[1 1].[1 18]>
442 ! ~zod/try/~2014.10.23..22.34.29..d399/:<[1 1].[1 18]>
445------------------------------------------------------------------------
451Parsing `++rule`. Parses a nonzero decimal digit.
462 ++ sed (cook |=(a/@ (sub a '0')) (shim '1' '9'))
473------------------------------------------------------------------------
479Parsing `++rule`. Parses a nonzero base-32 digit
490 ++ sev ;~(pose sed sov)
497 ~zod/socialnet=> (scan "0" sev:ab)
501------------------------------------------------------------------------
507Parsing `++rule`. Parses a nonzero base-64 digit
518 ++ sew ;~(pose sed sow)
529------------------------------------------------------------------------
535Parsing `++rule`. Parses a nonzero hexadecimal digit.
546 ++ sex ;~(pose sed sox)
557------------------------------------------------------------------------
563Parsing `++rule`. Parses a binary digit.
574 ++ sib (cook |=(a/@ (sub a '0')) (shim '0' '1'))
581 ~zod/socialnet=> (scan "0" sib:ab)
584------------------------------------------------------------------------
590Parsing `++rule`. Parses a decimal digit.
601 ++ sid (cook |=(a/@ (sub a '0')) (shim '0' '9'))
609------------------------------------------------------------------------
615Parsing `++rule`. Parses a base-32 digit.
626 ++ siv ;~(pose sid sov)
634------------------------------------------------------------------------
640Parsing `++rule`. Parses a base-64 digit.
651 ++ siw ;~(pose sid sow)
659------------------------------------------------------------------------
665Parsing `++rule`. Parses a hexadecimal digit.
676 ++ six ;~(pose sid sox)
684------------------------------------------------------------------------
690Parsing `++rule`. Parses a base-32 letter.
701 ++ sov (cook |=(a/@ (sub a 87)) (shim 'a' 'v'))
709------------------------------------------------------------------------
715Parsing `++rule`. Parses a base-64 letter/symbol.
727 (cook |=(a/@ (sub a 87)) (shim 'a' 'z'))
728 (cook |=(a/@ (sub a 29)) (shim 'A' 'Z'))
739------------------------------------------------------------------------
745Parsing `++rule`. Parses a hexadecimal letter.
756 ++ sox (cook |=(a/@ (sub a 87)) (shim 'a' 'f'))
764------------------------------------------------------------------------
770Parsing `++rule`. Parses a decimal number of up to 3 digits without a
782 ++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
789 > (scan "214" ted:ab)
791 > (scan "2140" ted:ab)
797------------------------------------------------------------------------
803Parsing `++rule`. Parses the leading phonetic byte, which represents a
815 ++ tip (sear |=(a/@ (ins:po a)) til)
820 > (scan "doz" tip:ab)
822 > (scan "pit" tip:ab)
825------------------------------------------------------------------------
829Trailing phonetic syllable
831Parsing `++rule`. Parses the trailing phonetic byte, which represents a
843 ++ tiq (sear |=(a/@ (ind:po a)) til)
848 > (scan "zod" tiq:ab)
850 > (scan "nec" tiq:ab)
853------------------------------------------------------------------------
857Parse 3 decimal digits
859Parsing `++rule`. Parses exactly three decimal digits.
870 ++ tid (bass 10 (stun [3 3] sid))
875 > (scan "013" tid:ab)
881------------------------------------------------------------------------
887Parsing `++rule`. Parses exactly three lowercase letters.
898 ++ til (boss 256 (stun [3 3] low))
903 > (scan "mer" til:ab)
905 > `@t`(scan "mer" til:ab)
911------------------------------------------------------------------------
917Parsing rule. Parses characters from an atom of the span odor `@ta`.
929 |=(a/tape (rap 3 ^-((list @) a)))
930 (star ;~(pose nud low hep dot sig cab))
935 > `@ta`(scan "asa-lom_tak" urs:ab)
937 > `@t`(scan "asa-lom_tak" urs:ab)
940------------------------------------------------------------------------
946Parsing rule. Parses all characters of the span odor `@ta` except
959 |=(a/tape (rap 3 ^-((list @) a)))
960 (star ;~(pose nud low hep dot sig))
965 > `@t`(scan "asa-lom.t0k" urt:ab)
968------------------------------------------------------------------------
972Parse bas, soq, or bix
974Parsing rule. Parses an escaped backslash, single quote, or hex pair
986 ++ voy ;~(pfix bas ;~(pose bas soq bix))
991 > (scan "\\0a" voy:ab)
993 > (scan "\\'" voy:ab)
996------------------------------------------------------------------------
1000Top-level atom parser engine
1002A core containing top-level atom parsers.
1020 <14.vpu 414.mof 100.xkc 1.ypj %164>
1022------------------------------------------------------------------------
1028Parser modifier. Parses 0 or the sample rule `fel`.
1041 ++ ape |*(fel/rule ;~(pose (cold 0 (just '0')) fel))
1047 > (scan "202" (star (ape:ag (cold 2 (just '2')))))
1050------------------------------------------------------------------------
1056Parsing rule. Parses a binary number without a leading zero.
1067 ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
1072 > (scan "10.0110" bay:ag)
1075------------------------------------------------------------------------
1081Parsing 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 > (scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1099 q=283.183.420.760.121.105.516.068.864
1100 > `@is`(scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1101 .0.0.ea.3e6c.0.0.0.0
1103------------------------------------------------------------------------
1107Parse decimal with dots
1109Parsing rule. Parses a decimal number that includes dot separators.
1120 ++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab)))))
1126 > (scan "52" dem:ag)
1128 > (scan "13.507" dem:ag)
1131------------------------------------------------------------------------
1137Parsing rule. Parses a decimal number without a leading zero.
1148 ++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab))))
1153 > (scan "52" dim:ag)
1155 > (scan "013507" dim:ag)
1159------------------------------------------------------------------------
1163Parse decimal with leading `0`
1165Parsing rule. Parses a decmial number with leading zeroes.
1176 ++ dum (bass 10 (plus sid:ab))
1181 > (scan "52" dum:ag)
1183 > (scan "0000052" dum:ag)
1185 > (scan "13507" dim:ag)
1188------------------------------------------------------------------------
1194Parsing rule. Parses an atom of odor `@p`, the phonetic base.
1206 (bass 0x1.0000.0000.0000.0000 (most doh hyf:ab))
1215 > (scan "zod" fed:ag)
1217 > (scan "nec" fed:ag)
1219 > (scan "sondel" fed:ag)
1223 > (scan "tillyn-nillyt" fed:ag)
1225 > (scan "tillyn-nillyt-tasfyn-partyv" fed:ag)
1226 15.331.165.687.565.582.592
1227 > (scan "tillyn-nillyt-tasfyn-partyv--novweb-talrud-talmud-sonfyr" fed:ag)
1228 282.810.089.790.159.633.869.501.053.313.363.681.181
1230------------------------------------------------------------------------
1236Parsing rule. Parses a hexadecimal number
1247 ++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
1254 > (scan "1a" hex:ag)
1256 > (scan "3.ac8d" hex:ag)
1258 > `@ux`(scan "3.ac8d" hex:ag)
1261------------------------------------------------------------------------
1267Parsing rule. Parses an IPv4 address.
1278 ++ lip =+ tod=(ape ted:ab)
1279 (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
1284 > (scan "127.0.0.1" lip:ag)
1286 > `@if`(scan "127.0.0.1" lip:ag)
1288 > `@if`(scan "8.8.8.8" lip:ag)
1291------------------------------------------------------------------------
1295Parse Base-32 with dots
1297Parsing rule. Parses a Base-32 number with dot separators.
1308 ++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
1313 > (scan "e2.ol4pm" viz:ag)
1316------------------------------------------------------------------------
1322Parsing rule. Parses a raw base-32 string.
1333 ++ vum (bass 32 (plus siv:ab))
1338 > (scan "e2ol4pm" vum:ag)
1341------------------------------------------------------------------------
1347Parsing rule. Parses a base-64 number.
1358 ++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
1365 > (scan "e2O.l4Xpm" wiz:ag)
1366 q=61.764.130.813.526
1371Core used to scramble 16-bit atoms
1373A door that contains arms that are used to scramble two atoms, `top`
1374and `bot`. Used especially in the phonetic base to disguise the
1375relationship between a destroyer and its cruiser.
1396 > ~(. mu 0x20e5 0x5901)
1397 <3.sjm [[@ux @ux] <414.hhh 100.xkc 1.ypj %164>]>
1399------------------------------------------------------------------------
1405Produces the cell of `top` and `bot` with `top` scrambled to the result
1406of adding `bot` to `top` modulo 16. Used to scramble the name of a
1422 ++ zag [p=(end 4 1 (add top bot)) q=bot]
1428 > `[@ux @ux]`~(zag mu 0x20e0 0x201)
1431------------------------------------------------------------------------
1435Subtract bottom from top
1437The inverse of `++zag`. Produces the cell of `top` and `bot` with
1438`top` unscrambled. The unscrambled `top` is the sum of the sample `top`
1439and the 16-bit complement of `bot`. Used to unscramble the name of the
1455 ++ zig [p=(end 4 1 (add top (sub 0x1.0000 bot))) q=bot]
1460 > `[@ux @ux]`~(zig mu 0x2f46 0x1042)
1463------------------------------------------------------------------------
1467Concatenate into atom
1469Produces the concatenation of `top` and `bot`. Used to assemble a
1485 ++ zug (mix (lsh 4 1 top) bot)
1490 > `@ux`~(zug mu 0x10e1 0xfa)
1498Digit rendering engine
1500A door containing arms that render digits at bases 10, 16, 32, and
1521 <4.gut [@ud <414.hhh 100.xkc 1.ypj %164>]>
1523------------------------------------------------------------------------
1529Renders a decimal digit as an atom of an ACII byte value.
1550------------------------------------------------------------------------
1556Renders a hexadecimal digit as an atom of an ASCII byte value.
1569 ++ x ?:((gte tig 10) (add tig 87) d)
1579------------------------------------------------------------------------
1585Renders a base-32 digit as an atom of an ASCII byte value.
1596 ++ v ?:((gte tig 10) (add tig 87) d)
1608------------------------------------------------------------------------
1614Renders a base-64 digit as an atom of an ASCII byte value.
1627 ++ 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