It was thus said that the Great Zane H. Healy once stated:
>
> > Hi
> > Try
> >
> >
> > : HI ." Hello World" ;
> >
> > HI
> >
> >
> > Dwight ;)
>
> Looks a lot like the "Hello, World" program I found on the net, unfortuantly
> I'm not having much luck.
>
> : HI ." Hello World" ; ."?
> : HI ."Hello World" ; ."HELLO?
> : HELLO ."Hello_World" ; ."HELLO_WORLD"?
One other thing about Forth---white space is *very* important and
identifiers ... okay, two things about Forth, white space is *very*
important, identifiers can contain *any* printable character and it's ... okay
three things about Forth, white space is *very* important, identifiers can
contain *any* printable character, it's stack based and ...
Oh drat it all.
Let's start over again ...
White space is very important since anything that *isn't* white space is
taken as a token and used to look up the current meaning. ." is a typical
Forth word that prints anything past it up to the next double quote. In
fact, it's perfectly legal to do:
: 2 1 ;
to redefine the sequence `2' to push the value 1 onto the stack (normally,
if a space delimited token isn't found, Forth will then attempt to convert
it (using the current base) into a number, and if that fails, then you get
an undefined error message (which is what is happening to you above). Some
systems actually do define:
: 0 0 ;
: 1 1 ;
: 2 2 ;
as that is slightly faster and takes less space than storing a literal
number in the internal representation (although that really depends upon the
Forth system).
-spc (Bring out the comfy chair ... )
Received on Tue Jun 25 2002 - 23:07:56 BST
This archive was generated by hypermail 2.3.0
: Fri Oct 10 2014 - 23:35:07 BST