)
WORD COUNT TYPE
; IMMEDIATE
This works fine when used in a line like:
.( HELLO)
5
.
but consider what happens if the user enters an empty
string:
.( )
5
.
The definition of .( shown above would treat the
)
as a leading delimiter, skip it, and continue
consuming characters until it located another )
that followed a non-)
character, or until the
parse area was empty. In the example shown, the
5
.
would be treated as part of the string to be printed.
With PARSE, we could write a correct definition of
.(:
: .(
[CHAR] )
PARSE TYPE
; IMMEDIATE
This definition avoids the "empty string" anomaly.