Janus

parse.ft.md


variable word-done

: parse-word    1 tstate ! begin  bl word  dup c@ while
                  find ?dup if
                    drop execute
                  else
                    ?number if
                      tstate @ if
                        t,lit t,
                      then
                    else count type [char] ? emit cr -1 throw then
                  then
                repeat drop ;

: read-word     false word-done ! begin
                  parse-word
                  word-done @ if exit then
                  refill
                0= until ;

: end-word      true word-done ! 0 tstate ! ;