( 54K . Rejoice | Dovem pro tle ) |00 @System/vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 |10 @Console/vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 |c0 @DateTime/year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 |7fff @inf |cf89 @inf/glyph |000 @token/+buf ( str[], 00.. ) $7e &+bufend $2 @item/+buf ( str[], 00.. ) $7e &+bufend $2 |100 @on-reset ( -> ) ;meta #06 DEO2 ( | Prefabs ) random/ ;dict/identity syms/find-alloc-force POP2 ( | Modes ) .Console/type DEI ?{ ;token/on-console-interactive .Console/vector DEO2 BRK } ;token/on-console .Console/vector DEO2 BRK @meta $1 ( name ) "Rejoice 0a ( desc ) "A 20 "Rejoice 20 "Interpreter 0a ( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a ( date ) "13 20 "Sep 20 "2026 0000 %u16/mod ( a* b* -- a%b* ) { DIV2k MUL2 SUB2 } %char/is-dec ( c -- t ) { LIT "0 SUB #0a LTH } %syms/get-name ( id* -- str* ) { DUP2 ADD2 ;syms/buf ADD2 LDA2 } %item/next ( item* -- next* ) { #0004 ADD2 } ( @|Token ) @token/on-console-interactive ( -> ) .Console/read DEI DUP / #0a NEQ ?{ world/ } BRK @token/on-console ( -> ) .Console/read DEI ( | Normalize ) DUP #20 GTH ?{ POP #20 } / [ LIT2 04 -Console/type ] DEI NEQ ?{ world/ #800f DEO } BRK @token/on-console-comment ( -> ) [ LIT2 ") -Console/read ] DEI NEQ ?{ [ LIT2 &comment-callback $2 ] .Console/vector DEO2 } BRK @token/on-console-string ( -> ) [ LIT2 "" -Console/read ] DEI NEQk ?{ POP2 [ LIT2 &string-callback $2 ] .Console/vector DEO2 BRK } DUP #20 NEQ ?{ POP [ LIT "\ ] / [ LIT "s ] } / POP BRK @token/ ( c -- ) DUP LIT "( NEQ ?{ .Console/vector DEI2 ,&comment-callback STR2 ;&on-console-comment .Console/vector DEO2 POP JMP2r } DUP LIT "" NEQ ?{ .Console/vector DEI2 ,&string-callback STR2 ;&on-console-string .Console/vector DEO2 POP JMP2r } DUP LIT "[ NEQ ?{ ,&+depth LDR INC ,&+depth STR } DUP LIT "] NEQ ?{ ,&+depth LDR #01 SUB ,&+depth STR } [ LIT &+depth $1 ] ?{ DUP #20 GTH ?{ POP / !/ } } [ LIT2 00 &+ptr -&+buf ] INCk ( clamp ) .&+bufend LTHk ?{ ;dict/token err/ SWP } POP ,&+ptr STR STZ2 JMP2r @token/ ( -- ) [ LIT2 -&+buf _&+ptr ] STR [ LIT2 00 -&+buf ] STZ JMP2r @token/ ( -- ) .&+buf ( exists ) LDZk ?{ POP JMP2r } ( @label ) LDZk LIT "@ EQU ?label/ ( 'quote ) LDZk LIT "' EQU ?label/ world/ ( >> ) @token/ ( ztr -- ) ( num bag ) item/parse-any-push world/ world/ LDZk LIT "/ EQU ?{ ( den bag [] ) world/ world/ POP JMP2r } INC ( den bag ) item/parse-any-push world/ POP JMP2r %label/get-addr ( id* -- addr* ) { DUP2 ADD2 ;label/buf ADD2 } %label/get ( id* -- addr* ) { label/get-addr LDA2 } @label/ ( ztr -- ) #0001 ;"e-name syms/find-alloc DUP2 / world/ world/ ,&id LDR INC ,&id STR INC !token/ "e-name "' [ &id "0 00 ] @label/ ( ztr -- ) #00 SWP INC syms/find-alloc ( >> ) @label/ ( id* -- ) /get-addr world/get-ptr SWP2 STA2 JMP2r ( @|Bag/Items ) %item/not-quote ( item* -- item* t ) { LDA2k syms/get-name LDA LIT "' NEQ } @item/ ( addr* -- ) INC2k INC2 LDA2 SWP2 LDA2 ( >> ) @item/ ( count* name* -- ) syms/ DUP2 #0002 LTH2 ?{ [ LIT2 "^ 19 ] DEO OVR #80 AND ?{ ( num reg ) !u16/ } ( ref reg ) #7fff AND2 syms/get-name !str/ } POP2 JMP2r @item/parse-any-push ( ztr -- ztr ) LDZk LIT "[ EQU ?/parse-wrap-push ( >> ) @item/parse-push ( ztr -- ztr ) LDZk [ LIT "[ ] EQU ?/parse-empty ( | not numeric ) [ LIT2 -&+buf _&+ptr ] STR &>w LDZk DUP symbol/is-spacer ?/parse-sym-push / INC !/>w @item/ ( c -- ) [ LIT2 00 &+ptr -&+buf ] INCk ( clamp ) .&+bufend LTHk ?{ ;dict/item err/ SWP } POP ,&+ptr STR STZ2 JMP2r @item/parse-sym-push ( ztr c -- ztr ) POP ( identity ) [ LIT2 -&+buf _&+ptr ] LDR EQU ?world/ /walk-count ;&+buf ( | emit symbol ) LDA2k [ LIT2 ".# ] NEQ2 ?{ NIP2 INC2k INC2 syms/find-alloc SWP2 } syms/find-alloc !world/ @item/parse-empty ( ztr -- ztr ) &>wpe LDZk LIT "] NEQ ?{ INC JMP2r } INC LDZk ?/>wpe JMP2r @item/parse-wrap-push ( ztr -- ztr ) ( walk [ ) INC ztr/walk-ws &>wwp /parse-push ztr/walk-ws LDZk [ LIT "] ] NEQ ?/>wwp ( walk ] ) INC JMP2r @item/walk-count ( ztr -- ztr count* ) LDZk LIT "^ NEQ ?{ INC LDZk char/is-dec ?dec-ztr/walk-u16 LDZ2k ;inf/glyph NEQ2 ?{ INC2 INC2 ;inf JMP2r } DUP symbol/walk ( ref reg ) #00 ROT syms/find-alloc #8000 ORA2 JMP2r } ( def reg ) #0001 JMP2r %fraction/den-length ( fraction* -- fraction* len* ) { LDA2k LDA2k SWP2 SUB2 } %fraction/is-unquoted ( fraction* -- fraction* t ) { DUP2 INC2k INC2 ( f* num[0].id ) LDA2 ( f* jump* = ) label/get NEQ2 } %fraction/get-multiplier ( item* -- mul* ) { tote/get-register STH2 LDA2 tote/get-addr LDA2 STH2r DIV2 } @fraction/ ( addr* -- ) ( num ) LDA2k OVR2 INC2 INC2 bag/ LDA2 INC2k INC2 LDA2 ORA ?{ POP2 JMP2r } ( den is not [] ) [ LIT2 "/ 19 ] DEO ( den ) LDA2k SWP2 INC2 INC2 ( >> ) @bag/ ( to* from* -- ) item/not-quote ?{ LIT "' char/ INC2 INC2 INC2 INC2 } ( | Not quote ) SUB2k #0004 GTH2 ?/ &>lpb DUP2 item/ item/next GTH2k ?/>lpb POP2 POP2 JMP2r @bag/ ( to* from* -- ) [ LIT2 "[ 19 ] DEO &>lpbc DUP2 item/ item/next EQU2k ?{ #2019 DEO } GTH2k ?/>lpbc POP2 POP2 [ LIT2 "] 19 ] DEO JMP2r ( @|World ) @world/get-ptr ( -- ptr* ) ,&+ptr LDR2 JMP2r @world/ ( -- ) #0000 #0000 ( >> ) @world/ ( count* id* -- ) / ( >> ) @world/ ( short* -- ) [ LIT2 &+ptr =&buf ] INC2k INC2 ( clamp ) ;&bufend LTH2k ?{ ;dict/world err/ SWP2 } POP2 ,&+ptr STR2 STA2 JMP2r @world/ ( -- ) ,&+ptr LDR2 ,&+scope STR2 #ffff !/ @world/ ( -- ) ,&+ptr LDR2 [ LIT2 &+scope $2 ] STA2 JMP2r @world/ ( -- ) tote/ ;&buf [ LIT2r 0001 ] &>w LDA2k ORA ?{ !/end } tote/ DUP2 tote/ DUP2 fraction/ #0a19 DEO goto/step INC2r !/>w &end ( addr* -- ) POP2 tote/ ( | steps ) ;dict/reached-a str/ STH2r u16/ ;dict/reached-b str/ syms/get-length #01 SFT2 #0001 SUB2 u16/ ;dict/reached-c !str/ @goto/step ( addr* -- addr* ) ,&+count LDR STHk ?{ POPr LDA2 LDA2 JMP2r } POP2 [ LIT2 00 _&+count ] STR ;&buf ,&+ptr STR2 STHkr #01 GTH ?{ POPr ;&buf LDA2 JMP2r } random/make #00 STHr u16/mod DUP2 ADD2 ;&buf ADD2 LDA2 JMP2r @goto/ ( addr* -- ) [ LIT &+count $1 ] INC ,&+count STR [ LIT2 &+ptr =&buf ] INC2k INC2 ( clamp ) ;&bufend LTH2k ?{ ;dict/goto err/ SWP2 } POP2 ,&+ptr STR2 STA2 JMP2r ( @|Tote ) %tote/get-addr ( id* -- addr* ) { DUP2 ADD2 ;tote/buf ADD2 } %tote/next-cell ( addr* -- next* ) { INC2 INC2 } %tote/has-item ( count* id* -- t ) { tote/get-addr LDA2 ADD2 POP #80 AND } @tote/get-register ( item* -- item* value* ) INC2k INC2 LDA2 OVR #80 AND ?{ JMP2r } #7fff AND2 /get-addr LDA2 JMP2r @tote/ ( item* name* -- ) str/ ( walk dot ) INC2 ( is emitter ) LDAk LIT "# EQU ?/ STH2 /get-register #0000 SWP2 SUB2 &>lpp STH2kr str/ INC2 ORAk ?/>lpp POP2 POP2 POP2r !str/ @tote/ ( item* name* -- ) POP2 INC2 INC2 LDA2 /get-addr LDA2 u16/ !str/ @tote/ ( item* -- ) LDA2k syms/get-name ( dup name* ) LDAk LIT ". EQU ?/ ( pop name* ) POP2 ( | detect label ) LDA2k label/get ( dup addr* ) ORAk ?/ ( pop addr* ) POP2 !queue/ @tote/ ( item* addr* -- ) STH2 INC2 INC2 LDA2 #0000 &>lpl STH2kr goto/ INC2 GTH2k ?/>lpl POP2 POP2 POP2r JMP2r @tote/ ( fraction* -- ) ( | take ) queue/ LDA2k LDA2k SWP2 /next-cell &>lac DUP2 queue/ item/next GTH2k ?/>lac POP2 POP2 ( | validate ) queue/can-apply ?{ POP2 JMP2r } ( | put ) LDA2k OVR2 /next-cell &>lap DUP2 / item/next GTH2k ?/>lap POP2 POP2 ( | multiplier ) fraction/is-unquoted ?{ fraction/den-length #0006 NEQ2 ?{ LDA2 INC2 INC2 fraction/get-multiplier !queue/ } } POP2 #0001 !queue/ @tote/get-range ( -- to* from* ) ( from* ) ;&buf ( from* to-ptr* ) DUP2 syms/get-length ADD2 ;&bufend ( from* min* ) [ LTH2k JMP SWP2 POP2 ] ( to* from* ) SWP2 JMP2r @tote/ ( -- ) [ LIT2 "[ 19 ] DEO [ LIT2r ff00 ] /get-range &>lp LDA2k #0000 EQU2 ?{ OVRr STHr ?{ #2019 DEO } LDA2k #00 STHkr item/ LIT2r 00ff AND2r } /next-cell INCr GTH2k ?/>lp POP2 POP2 POP2r [ LIT2 "] 19 ] DEO #2019 DEO JMP2r @tote/ ( -- ) /get-range &>lc #0000 OVR2 STA2 /next-cell GTH2k ?/>lc POP2 POP2 JMP2r @queue/ ( item* -- ) LDA2k ORAk ?{ ( zero ) POP2 ( id ) POP2 JMP2r } ( | Handle inf ) DUP2 tote/get-addr LDA2 ;inf NEQ2 ?{ OVR2 INC2 INC2 LDA2 ;inf EQU2 ?{ POP2 POP2 JMP2r } } ( | Handle dec ) /find INC2k ORA ?{ POP2 ( | Not null ) tote/get-register ORAk ?{ POP2 POP2 JMP2r } SWP2 ( id* ) LDA2 / ( count* ) #0000 SWP2 SUB2 !/ } ( | merge offset ) INC2 INC2 STH2 tote/get-register STH2kr LDA2 SWP2 SUB2 STH2r STA2 POP2 JMP2r @queue/ ( item* -- item* ) LDA2k ( | Handle inc ) /find INC2k ORA ?{ POP2 ( | Not null ) tote/get-register ORAk ?{ POP2 POP2 JMP2r } SWP2 ( id* ) LDA2 / ( count* ) !/ } ( | merge offset ) INC2 INC2 STH2 tote/get-register STH2kr LDA2 ADD2 STH2r STA2 POP2 JMP2r @queue/ ( -- ) ;&+buf ,&+ptr STR2 #0000 ;&+buf STA2 JMP2r @queue/ ( fraction* mul* -- ) STH2 ,&+ptr LDR2 ;&+buf &>l EQU2k ?{ INC2k INC2 LDA2 STH2kr MUL2 OVR2 LDA2 tote/get-addr LDA2k ROT2 ADD2 ( clamp ) ;inf LTH2k [ JMP SWP2 ] POP2 ( new-value* item* ) SWP2 STA2 item/next !/>l } POP2 POP2 POP2r JMP2r @queue/ ( value* -- ) [ LIT2 &+ptr =&+buf ] INC2k INC2 ( clamp ) ;&+bufend LTH2k ?{ ;dict/queue err/ SWP2 } POP2 ,&+ptr STR2 STA2 JMP2r @queue/find ( item* -- addr* ) STH2 ,&+ptr LDR2 ;&+buf &>lf LDA2k STH2kr EQU2 ?{ item/next GTH2k ?/>lf POP2 #ffff } NIP2 POP2r JMP2r @queue/can-apply ( -- t ) ,&+ptr LDR2 ;&+buf &>lca EQU2k ?{ ( item* count* ) INC2k INC2 LDA2 ( item* count* id* ) OVR2 LDA2 tote/has-item ?{ item/next !/>lca } } EQU2 JMP2r ( @|Dict ) @symbol/is-spacer ( c -- t ) DUP LIT 21 LTH ?{ DUP LIT "[ EQU ?{ DUP LIT "/ EQU ?{ DUP LIT "] EQU ?{ LIT "^ EQU JMP2r } } } } POP #01 JMP2r @symbol/walk ( ztr -- ztr ) &>ww LDZk /is-spacer ?{ INC2 !/>ww } JMP2r @symbol/new ( str* -- str* ) ;&+buf ,&+ptr STR2 #0000 ;&+buf STA2 &>wn LDAk /is-spacer ?{ LDAk / INC2 !/>wn } POP2 ;&+buf JMP2r @symbol/ ( c -- ) #00 [ LIT2 &+ptr =&+buf ] INC2k ( clamp ) ;&+bufend LTH2k ?{ ;dict/symbol err/ SWP2 } POP2 ,&+ptr STR2 STA2 JMP2r @syms/get-length ( -- length* ) ,&+ptr LDR2 ;&buf SUB2 JMP2r @syms/find ( str* -- id* ) STH2 ,&+ptr LDR2 ;&buf &>lf LDA2k STH2kr str/cmp ?{ INC2 INC2 GTH2k ?/>lf POP2r POP2 POP2 #ffff JMP2r } ( | found ) POP2r NIP2 JMP2r @syms/find-alloc ( str* -- id* ) symbol/new ( >> ) &find-alloc-force ( str* -- id* ) LDAk ?{ POP2 #0000 JMP2r } DUP2 /find INC2k ORA ?{ ( str* null* ) POP2 ( ptr* str* ) ,&+ptr LDR2 OVR2 dict/alloc ( | push ) [ LIT2 &+ptr =&buf ] INC2k INC2 ( clamp ) ;&bufend LTH2k ?{ ;dict/syms err/ SWP2 } POP2 ,&+ptr STR2 STA2 } NIP2 ;&buf SUB2 #01 SFT2 JMP2r @syms/ ( id* -- ) /get-name ( | quoted ) LDAk LIT "' NEQ ?str/ LDA !char/ @dict/alloc ( src* -- ptr* ) ,&+ptr LDR2 SWP2 &>w LDAk DUP [ LIT2 &+ptr =&buf ] INC2k ( clamp ) ;&bufend LTH2k ?{ ;&err-buffer ;&dict err/ SWP2 } POP2 ,&+ptr STR2 STA ?{ POP2 JMP2r } INC2 !/>w @dict/identity "[] 00 &reached-a 0a "Reached 20 "in 20 00 &reached-b 20 "steps, 20 "with 20 00 &reached-c 20 "symbols. 0a00 &err-buffer "buffer 20 "overflow. 0a00 &dict "Dict 00 &token "Token 00 &item "Item 00 &world "World 00 &goto "Goto 00 &queue "Queue 00 &syms "Syms 00 &symbol "Symbol 00 &inf =inf/glyph 00 @err/ ( name* -- ) ;dict/err-buffer SWP2 ( >> ) @err/ ( err* name* -- ) str/ #2019 DEO str/ #0000 .Console/vector DEO2 #010f DEO JMP2r ( @|Stdlib ) @dec-ztr/walk-u16 ( ztr -- ztr u16* ) [ LIT2r 0000 ] &>w16 LDZk LIT "0 SUB DUP #0a LTH ?{ POP STH2r #7fff AND2 JMP2r } [ LIT2r 000a ] MUL2r [ LITr 00 ] STH ADD2r INC !/>w16 @str/ ( str* -- ) LDAk DUP ?{ POP POP2 JMP2r } ( | esc ) [ LIT &+esc 01 ] ?{ DUP [ LIT "\ ] NEQ ?{ POP INC2 LDAk char/escape } } char/ INC2 !/ @str/ ( -- ) [ LIT2 18 _char/port ] STR [ LIT2 00 _&+esc ] STR JMP2r @str/ ( -- ) [ LIT2 19 _char/port ] STR [ LIT2 01 _&+esc ] STR JMP2r @char/ ( d -- ) LIT "0 ADD ( >> ) @char/ ( c -- ) [ LIT &port 19 ] DEO JMP2r @char/escape ( byte -- byte ) DUP [ LIT "t ] NEQ ?{ POP #09 JMP2r } [ LIT "n ] NEQ ?{ #0a JMP2r } #20 JMP2r @ztr/walk-ws ( ztr -- ztr ) LDZk #20 NEQ ?{ INC !/walk-ws } JMP2r @str/cmp ( a* b* -- bool ) STH2 &>wc LDAk ?{ &d LDA LDAr STHr EQU JMP2r } LDAk LDAkr STHr NEQ ?/d INC2 INC2r !/>wc @u16/ ( u16* -- ) DUP2 ;inf NEQ2 ?{ POP2 ;dict/inf !str/ } [ LIT2r ff00 ] &>read #000a DIV2k STH2k MUL2 SUB2 STH2r INCr ORAk ?/>read POP2 &>write NIP char/ OVRr ADDr STHkr ?/>write POP2r JMP2r @random/ ( -- ) [ LIT2 00 -DateTime/second ] DEI ( ) [ LIT2 00 -DateTime/minute ] DEI #60 SFT2 EOR2 ( ) [ LIT2 00 -DateTime/hour ] DEI #c0 SFT2 EOR2 ,&x STR2 [ LIT2 00 -DateTime/day ] DEI #04 SFT2 ( ) [ LIT2 00 -DateTime/month ] DEI #10 SFT2 EOR2 ( ) [ LIT2 00 -DateTime/second ] DEI #60 SFT2 EOR2 ( ) .DateTime/year DEI2 #a0 SFT2 EOR2 ,&y STR2 JMP2r @random/make ( -- number* ) [ LIT2 &x $2 ] ( ) DUP2 #50 SFT2 EOR2 ( ) DUP2 #03 SFT2 EOR2 ( ) [ LIT2 &y $2 ] ( ) DUP2 ,&x STR2 DUP2 #01 SFT2 EOR2 EOR2 ( ) ,&y STR2k POP JMP2r ( @|Buffers ) @symbol/+buf ( str[], 00.. ) $40 &+bufend @syms/buf ( dict*, dict*, dict*, dict*.. ) $200 &bufend @tote/buf ( length*, length*, length*.. ) $200 &bufend @goto/buf ( addr*, addr*.. ) $200 &bufend @label/buf ( addr*, addr*, addr*, addr*.. ) $200 &bufend @queue/+buf ( id*, count*, id*, count*.. ) $80 &+bufend @dict/buf ( str[], 00, str[], 00.. ) $1000 &bufend @world/buf ( id*, count*, id*, count*.. ) |fffe &bufend