2title = "4j: Parsing (Bases and Base Digits)"
11A core containing numeric parser primitives.
24<36.ecc 414.gly 100.xkc 1.ypj %164>
33Parsing `rule`. Parses a pair of base-16 digits. Used in escapes.
38++ bix (bass 16 (stun [2 2] six))
58Parse a single base58check character.
63++ fem (sear |=(a=@ (cha:fa a)) aln)
83Parse non-doz phonetic pair
85Parsing `rule`. Parses an atom of aura `@pE`, a phrase of two bytes encoded
86phonetically. If the leading syllable is `doz` (`0`), parsing will fail.
91++ haf (bass 256 ;~(plug tep tiq (easy ~)))
97> `@p`(scan "sampel" haf:ab)
100> `@p`(scan "dozpel" haf:ab)
109Parse non-dozzod phonetic pair
111Parsing `rule`. Parses an atom of aura `@pE` without leading `~` or `.~`, a
112phrase of two bytes encoded phonetically. If it's `dozzod`, parsing will fail.
117++ hef %+ sear |=(a=@ ?:(=(a 0) ~ (some a)))
119 ;~(plug tip tiq (easy ~))
125> `@p`(scan "sampel" hef:ab)
128> `@p`(scan "dozpel" hef:ab)
131> `@p`(scan "dozzod" hef:ab)
142Parsing `rule`. Parses an atom of aura `@pE`, without leading `~` or `.~`. A
143phrase of two bytes encoded phonetically.
148++ hif (boss 256 ;~(plug tip tiq (easy ~)))
154> `@p`(scan "doznec" hif:ab)
157> `@p`(scan "pittyp" hif:ab)
165Parse 2-4 @q phonetic pairs
167Parsing `rule`. Parses an atom of aura `@q` (non-scrambled `@p`), without
168leading `~` or `.~`, of between two and four phrases.
173++ hof (bass 0x1.0000 ;~(plug hef (stun [1 3] ;~(pfix hep hif))))
179> `@q`(scan "sampel-palnet" hof:ab)
182> `@q`(scan "sampel-sampel-palnet" hof:ab)
183.~sampel-sampel-palnet
185> `@q`(scan "sampel-sampel-sampel-palnet" hof:ab)
186.~sampel-sampel-sampel-palnet
193Parse 1-4 @q phonetic pairs
195Parsing `rule`. Parses an atom of aura `@q` (non-scrambled `@p`), without
196leading `~` or `.~`, of between one and four phrases.
201++ huf (bass 0x1.0000 ;~(plug hef (stun [0 3] ;~(pfix hep hif))))
207> `@q`(scan "sampel" huf:ab)
210> `@q`(scan "sampel-palnet" huf:ab)
213> `@q`(scan "sampel-sampel-palnet" huf:ab)
214.~sampel-sampel-palnet
216> `@q`(scan "sampel-sampel-sampel-palnet" huf:ab)
217.~sampel-sampel-sampel-palnet
224Parse four @q phonetic pairs
226Parsing `rule`. Parses an atom of aura `@q` (non-scrambled `@p`), without
227leading `~` or `.~`, of exactly four phrases.
232++ hyf (bass 0x1.0000 ;~(plug hif (stun [3 3] ;~(pfix hep hif))))
238> `@q`(scan "sampel-sampel-sampel-palnet" hyf:ab)
239.~sampel-sampel-sampel-palnet
246Parse 1-5 @uv base-32 chars
248Parsing `rule`. Parses one to five `@uv` base-32 digits without the leading `0v`
254++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
260> `@uv`(scan "du3ja" pev:ab)
263> `@uv`(scan "3ja" pev:ab)
266> `@uv`(scan "a" pev:ab)
274Parse 1-5 @uw base-64 chars
276Parsing `rule`. Parses one to five `@uw` base-64 digits without the leading `0w`
282++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
288> `@uw`(scan "6U0gP" pew:ab)
291> `@uw`(scan "gP" pew:ab)
294> `@uw`(scan "P" pew:ab)
302Parse 5 @uv base-32 chars
304Parsing `rule`. Parses exactly five `@uv` base-32 digits without the leading
305`0v` or leading zeros.
310++ piv (bass 32 (stun [5 5] siv))
316> `@uv`(scan "du3ja" piv:ab)
319> `@uv`(scan "u3ja" piv:ab)
328Parse 5 @uw base-64 chars
330Parsing `rule`. Parses exactly five `@uw` base-64 digits without the leading
331`0w` or leading zeros.
336++ piw (bass 64 (stun [5 5] siw))
342> `@uw`(scan "6U0gP" piw:ab)
345> `@uw`(scan "U0gP" piw:ab)
354Parse 1-4 binary digits
356Parsing `rule`. Parses a binary number of up to 4 digits in length without a
362++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
368> `@ub`(scan "1010" qeb:ab)
371> `@ub`(scan "10" qeb:ab)
374> `@ub`(scan "1" qeb:ab)
377> `@ub`(scan "0" qeb:ab)
388Parsing `rule`. Parses a hexadecimal number of up to 4 digits in length without
394++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
400> `@ux`(scan "beef" qex:ab)
403> `@ux`(scan "ef" qex:ab)
406> `@ux`(scan "f" qex:ab)
416Parsing `rule`. Parses exactly four binary digits - may have leading zeros.
421++ qib (bass 2 (stun [4 4] sib))
427> `@ub`(scan "0001" qib:ab)
430> `@ub`(scan "1001" qib:ab)
433> `@ub`(scan "1" qib:ab)
444Parsing `rule`. Parses exactly four hexadecimal digits - may have leading zeros.
449++ qix (bass 16 (stun [4 4] six))
455> `@ux`(scan "beef" qix:ab)
458> `@ux`(scan "0000" qix:ab)
461> `@ux`(scan "ef" qix:ab)
472Parsing `rule`. Parses the number 1.
477++ seb (cold 1 (just '1'))
497Parsing `rule`. Parses a nonzero decimal digit.
502++ sed (cook |=(a=@ (sub a '0')) (shim '1' '9'))
522Parsing `rule`. Parses a nonzero base-32 digit.
527++ sev ;~(pose sed sov)
533> `@uv`(scan "2" sev:ab)
536> `@uv`(scan "j" sev:ab)
539> `@uv`(scan "0" sev:ab)
550Parsing `rule`. Parses a nonzero base-64 digit.
555++ sew ;~(pose sed sow)
561> `@uw`(scan "I" sew:ab)
564> `@uw`(scan "2" sew:ab)
567> `@uw`(scan "0" sew:ab)
578Parsing `rule`. Parses a non-zero hexadecimal digit.
583++ sex ;~(pose sed sox)
589> `@ux`(scan "a" sex:ab)
592> `@ux`(scan "2" sex:ab)
595> `@ux`(scan "0" sex:ab)
606Parsing `rule`. Parses a binary digit.
611++ sib (cook |=(a=@ (sub a '0')) (shim '0' '1'))
617> `@ub`(scan "1" sib:ab)
620> `@ub`(scan "0" sib:ab)
630Parsing `rule`. Parses a decimal digit.
635++ sid (cook |=(a=@ (sub a '0')) (shim '0' '9'))
654Parsing `rule`. Parses a base-32 digit.
659++ siv ;~(pose sid sov)
665> `@uv`(scan "r" siv:ab)
668> `@uv`(scan "5" siv:ab)
671> `@uv`(scan "0" siv:ab)
681Parsing `rule`. Parses a base-64 digit.
686++ siw ;~(pose sid sow)
692> `@uw`(scan "M" siw:ab)
695> `@uw`(scan "0" siw:ab)
698> `@uw`(scan "c" siw:ab)
708Parsing `rule`. Parses a hexadecimal digit.
713++ six ;~(pose sid sox)
719> `@ux`(scan "e" six:ab)
722> `@ux`(scan "0" six:ab)
730Parse @uv base-32 letter
732Parsing `rule`. Parses a `@uv` base-32 letter (but not a number).
737++ sov (cook |=(a=@ (sub a 87)) (shim 'a' 'v'))
743> `@uv`(scan "c" sov:ab)
746> `@uv`(scan "j" sov:ab)
749> `@uv`(scan "5" sov:ab)
758Parse @uw base-64 letter/symbol
760Parsing `rule`. Parses a base-64 letter/symbol (but not number).
766 (cook |=(a=@ (sub a 87)) (shim 'a' 'z'))
767 (cook |=(a=@ (sub a 29)) (shim 'A' 'Z'))
776> `@uw`(scan "M" sow:ab)
779> `@uw`(scan "5" sow:ab)
790Parsing `rule`. Parses a hexadecimal letter (but not number).
795++ sox (cook |=(a=@ (sub a 87)) (shim 'a' 'f'))
801> `@ux`(scan "e" sox:ab)
804> `@ux`(scan "5" sox:ab)
815Parsing `rule`. Parses a decimal number of up to 3 digits without a
821++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
833> (scan "2161" ted:ab)
842Parse non-doz leading phonetic byte
844Parsing `rule`. Parses the leading phonetic byte , which represents a syllable.
850++ tep (sear |=(a=@ ?:(=(a 'doz') ~ (ins:po a))) til)
869Parsing `rule`. Parses the leading phonetic byte, which represents a syllable.
874++ tip (sear |=(a=@ (ins:po a)) til)
891Trailing phonetic syllable
893Parsing `rule`. Parses the trailing phonetic byte, which represents a syllable.
898++ tiq (sear |=(a=@ (ind:po a)) til)
914Parse 3 decimal digits
916Parsing `rule`. Parses exactly three decimal digits.
921++ tid (bass 10 (stun [3 3] sid))
944Parsing `rule`. Parses exactly three lowercase letters.
949++ til (boss 256 (stun [3 3] low))
955> `@t`(scan "mer" til:ab)
958> `@t`(scan "me" til:ab)
969Parsing rule. Parses characters from an atom of the knot aura `@ta`.
975 |=(a=tape (rap 3 ^-((list @) a)))
976 (star ;~(pose nud low hep dot sig cab))
982> `@ta`(scan "asa-lom_tak" urs:ab)
990Parse knot without underscores
992Parsing `rule`. Parses all characters of the knot aura `@ta` except for cab,
999 |=(a=tape (rap 3 ^-((list @) a)))
1000 (star ;~(pose nud low hep dot sig))
1006> `@ta`(scan "asa-lom.t0k" urt:ab)
1014Parse bas, soq, or bix
1016Parsing `rule`. Parses an escaped backslash, single quote, or hex pair byte.
1021++ voy ;~(pfix bas ;~(pose bas soq bix))
1027> (scan "\\\\" voy:ab)
1030> (scan "\\'" voy:ab)
1033> (scan "\\0a" voy:ab)
1041Top-level atom parser engine
1043A core containing top-level atom parsers.
1058Parser modifier. Parses 0 or the sample rule `fel`.
1071++ ape |*(fel=rule ;~(pose (cold 0 (just '0')) fel))
1077> (scan "0" (ape:ag (cold 2 (just '2'))))
1080> (scan "2" (ape:ag (cold 2 (just '2'))))
1083> (scan "3" (ape:ag (cold 2 (just '2'))))
1094Parsing `rule`. Parses a binary number without a leading zero.
1099++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
1105> `@ub`(scan "101.1100.0011.1010" bay:ag)
1115Parsing rule. Parses a `@is`, an IPv6 address.
1120++ bip =+ tod=(ape qex:ab)
1121 (bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod))))
1127> `@is`(scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1135Parse decimal with dots
1137Parsing `rule`. Parses a decimal number that includes dot separators.
1142++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab)))))
1150> (scan "13.507" dem:ag)
1160Parsing rule. Parses a decimal number without a leading zero.
1177> (scan "13507" dim:ag)
1180> (scan "013507" dim:ag)
1189Parse decimal with leading `0`
1191Parsing rule. Parses a decmial number with leading zeroes.
1196++ dum (bass 10 (plus sid:ab))
1204> (scan "0000052" dum:ag)
1206> (scan "13507" dim:ag)
1216Parsing rule. Parses an atom of aura `@p`, the phonetic base.
1221++ fed %+ cook fynd:ob
1223 %+ bass 0x1.0000.0000.0000.0000 :: oversized
1226 (plus ;~(pfix doh hyf:ab))
1228 hof:ab :: planet or moon
1237> `@p`(scan "zod" fed:ag)
1240> `@p`(scan "sampel" fed:ag)
1243> `@p`(scan "sampel-palnet" fed:ag)
1246> `@p`(scan "sampel-palnet-sampel-palnet" fed:ag)
1247~sampel-palnet-sampel-palnet
1249> `@p`(scan "tillyn-nillyt-tasfyn-partyv--novweb-talrud-talmud-sonfyr" fed:ag)
1250~tillyn-nillyt-tasfyn-partyv--novweb-talrud-talmud-sonfyr
1257Parse `@q` phonetic base
1259Parsing rule. Parses an atom of aura `@q` (an unscrambled `@p`).
1264++ feq %+ cook |=(a=(list @) (rep 4 (flop a)))
1266 ;~(pose hif:ab tiq:ab)
1267 (star ;~(pfix dof hif:ab))
1274> `@q`(scan "sampel" feq:ag)
1277> `@q`(scan "sampel-palnet" feq:ag)
1280> `@q`(scan "sampel-sampel-palnet" feq:ag)
1281.~sampel-sampel-palnet
1283> `@q`(scan "sampel-palnet-sampel-palnet" feq:ag)
1284.~sampel-palnet-sampel-palnet
1286> `@q`(scan "sampel-sampel-sampel-sampel-palnet-sampel-palnet" feq:ag)
1287.~sampel-sampel-sampel-sampel-palnet-sampel-palnet
1296Parse a base58check value, check checksum, and return decoded value sans-checksum. If
1297the checksum check fails, parsing will fail.
1302++ fim (sear den:fa (bass 58 (plus fem:ab)))
1310> (enc:fa 0xdead.beef)
13110xdead.beef.938b.8b0c
1312> (c-co:co 0xdead.beef.938b.8b0c)
1314> `@ux`(scan "eFGDJSVvRHd" fim:ag)
1318With invalid checksum:
1321> (c-co:co 0xdead.beef.ffff)
1323> `@ux`(scan "2utUWE41U" fim:ag)
1334Parsing `rule`. Parses a hexadecimal number
1339++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
1345> `@ux`(scan "4" hex:ag)
1348> `@ux`(scan "1a" hex:ag)
1351> `@ux`(scan "3.ac8d" hex:ag)
1361Parsing `rule`. Parses an IPv4 address.
1366++ lip =+ tod=(ape ted:ab)
1367 (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
1373> `@if`(scan "127.0.0.1" lip:ag)
1381Parse numerical month
1383Parse a numerical month (1-12).
1391 (cook |=(a=@ (add 10 (sub a '0'))) (shim '0' '2'))
1422Parse Base-32 with dots
1424Parsing `rule`. Parses a Base-32 number with dot separators.
1429++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
1435> `@uv`(scan "e2.ol4pm" viz:ag)
1445Parsing `rule`. Parses a raw base-32 string (without dots).
1450++ vum (bass 32 (plus siv:ab))
1456> `@uv`(scan "e2ol4pm" vum:ag)
1466Parsing `rule`. Parses a base-64 number.
1471++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
1477> `@uw`(scan "e2O.l4Xpm" wiz:ag)
1485Core used to scramble 16-bit atoms
1487A door that contains arms that are used to scramble two atoms, `top`
1488and `bot`. Used especially in the phonetic base to disguise the
1489relationship between a planet and its star.
1510Produces the cell of `top` and `bot` with `top` scrambled to the result
1511of adding `bot` to `top` modulo 16. Used to scramble the name of a
1516`top` & `bot` are atoms, and are the sample of `+mu`.
1525++ zag [p=(end 4 (add top bot)) q=bot]
1531> `[@ux @ux]`~(zag mu 0x20e0 0x201)
1539Subtract bottom from top
1541The inverse of [`++zag`](#zagmu). Produces the cell of `top` and `bot` with
1542`top` unscrambled. The unscrambled `top` is the sum of the sample `top` and the
154316-bit complement of `bot`. Used to unscramble the name of the planet.
1547`top` & `bot` are atoms, and are the sample of `+mu`.
1556++ zig [p=(end 4 (add top (sub 0x1.0000 bot))) q=bot]
1562> `[@ux @ux]`~(zig mu 0x22e1 0x201)
1570Concatenate into atom
1572Produces the concatenation of `top` and `bot`. Used to assemble a
1577`top` & `bot` are atoms, and are the sample of `+mu`.
1586++ zug (mix (lsh 4 top) bot)
1592> `@ux`~(zug mu 0x22e1 0x201)
1600Digit rendering engine
1602A door containing arms that render digits at bases 10, 16, 32, and 64.
1621Render a single base58check character.
1625`tig` is an `atom`, and is the sample of `+ne`.
1634++ c (cut 3 [tig 1] key:fa)
1659Renders a decimal digit as an atom of an ACII byte value.
1663`tig` is an `atom`, and is the sample of `+ne`.
1688Renders a hexadecimal digit as an atom of an ASCII byte value.
1692`tig` is an `atom`, and is the sample of `+ne`.
1701++ x ?:((gte tig 10) (add tig 87) d)
1720Renders a base-32 digit as an atom of an ASCII byte value.
1724`tig` is an `atom`, and is the sample of `+ne`.
1733++ v ?:((gte tig 10) (add tig 87) d)
1755Renders a base-64 digit as an atom of an ASCII byte value.
1759`tig` is an `atom`, and is the sample of `+ne`.
1768++ 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