+ pop-parse-idx
+;
+
+: character? ( -- bool )
+ nextchar [char] # <> if false exit then
+
+ push-parse-idx
+ inc-parse-idx
+
+ nextchar [char] \ <> if pop-parse-idx false exit then
+
+ inc-parse-idx
+
+ S" newline" str-equiv? if true exit then
+ S" space" str-equiv? if true exit then
+ S" tab" str-equiv? if true exit then
+
+ charavailable? false = if pop-parse-idx false exit then
+
+ pop-parse-idx true
+;
+
+: readnum ( -- num-atom )
+ minus? dup if
+ inc-parse-idx
+ then
+
+ 0
+
+ begin digit? while
+ 10 * nextchar [char] 0 - +
+ inc-parse-idx
+ repeat
+
+ swap if negate then
+
+ number-type
+;
+
+: readbool ( -- bool-atom )
+ inc-parse-idx
+
+ nextchar [char] f = if
+ false
+ else
+ true
+ then
+
+ inc-parse-idx
+
+ boolean-type
+;
+
+\ Parse a scheme expression
+: read ( -- obj )
+
+ eatspaces
+
+ number? if
+ readnum