6 include term-colours.4th
9 : istype? ( obj -- obj b )
15 variable dummy-parse-idx
18 parse-idx @ dummy-parse-idx ! ;
21 dummy-parse-idx @ parse-idx ! ;
25 : charavailable? ( -- bool )
26 parse-str @ @ parse-idx @ >
29 : nextchar ( -- char )
31 parse-str @ 1+ parse-idx @ + @
37 : whitespace? ( -- bool )
44 nextchar [char] ( = or
45 nextchar [char] ) = or
65 digit? minus? or false = if
77 delim? charavailable? false = or if
86 : readnum ( -- num-atom )
94 10 * nextchar [char] 0 - +
103 \ Parse a counted string into a scheme expression
112 ." Error parsing string at character" parse-idx ? ." . Aborting." cr
118 : self-evaluating? ( obj -- obj bool )
119 number-type istype? ;
126 ." Error evaluating expression - unrecognized type. Aborting." cr
133 number-type istype? if
140 create repl-buffer 161 allot
141 repl-buffer parse-str !
144 repl-buffer 1+ 160 expect cr span @ repl-buffer ! ;
147 repl-buffer @ 0= if false exit then
148 repl-buffer 1+ @ 4 <> if false exit then
152 cr ." Welcome to scheme.forth.jl!" cr
153 ." Use Ctrl-D to exit." cr
156 cr bold fg green ." => " reset-term
160 fg blue ." Moriturus te saluto." reset-term