Go to the first, previous, next, last section, table of contents.

MUF Words Are Whitespace-Delimited

As befits a very simple language, MUF uses a very simple rule to understand the instructions you type in for it:

Lines of text you type in are separated into words surrounded by whitespace.

Whitespace is anything that doesn't put ink on the paper when printed: spaces, tabs, newlines... MUF treats all whitespace, in any amount, alike. Thus, all the following mean exactly the same thing as far as MUF is concerned:

: hw "Hello world\n" , ;
     :    hw    "Hello world\n"    ,    ;

: hw
  "Hello world\n" ,

"Hello world\n"

In particular, note that all printing characters are alike as far as MUF is concerned when it comes to forming words; each of the following lines contains one word as far as MUF is concerned:


They are all surrounded by whitespace, and that's all MUF cares about. A very simple, predictable mind, MUF has!

Note: As a practical matter, it is best to make words from letters and dashes. In particular, leading '#' characters are good to avoid, as they will be acquiring special meanings in future releases.

EXCEPTIONS: The only exceptions to this rule are a few situations involving quotations of various sorts. For example, we would like to be able to enter a string to be printed like

"Hello world!"

and have MUF treat it as a single piece that we can print out in one operation, rather than having to quote and print each word one at a time. So MUF has a special hack just for words which begin with a doubleQuote: it takes all text up until the next doubleQuote as constituting a single quotation, whitespace and all.

A similar quotation problem arises when trying to quote single characters: suppose we want to quote a blank? A nice syntax for doing this is just:

' '

But this obviously won't work if MUF does absolutely all separation of input text based on whitespace: it would interpret the above as two single quotes or something equally unhelpful. So, again, a special rule is made for words beginning with single-quotes.

A third such quotation problem arises when we want to include comments for humans in our MUF code without confusing MUF itself, which is far too stupid to understand them. We certainly don't want to have to quote every single word in our comments. So, again, we stick a special little hack in MUF telling it that if it sees a word consisting of just a left parenthesis, it should completely ignore everything until the next right parenthesis:

( This is a comment -- completely invisible to MUF. )
( This is also a comment. )
( I am invisible too. Whee! )
(I am not a comment! I don't start with a whitespace-surrounded '('! )

Note: The closing parenthesis must be preceded by whitespace. This allows you to safely use parenthesis in your comments, since in normal English usage a right (left) parenthesis is normally not preceded (followed) by whitespace.

Go to the first, previous, next, last section, table of contents.