MUF MUF

MUF - Definition and Overview

MUF (short for Mucker's Forth or Multi-User Forth) is a Forth-based programming language used on TinyMUCK MUCK servers and their descendants, including Fuzzball MUCK, ProtoMUCK and GlowMUCK.

MUF is used largely as the systems-programming language for TinyMUCK systems; many fundamental commands are, in fact, implemented using MUF programs, and built-in commands of the MUCK server are often replaced with more sophisticated versions written in MUF.

Contents

The MUF Stack

MUF is a Stack-oriented programming language, and is written using Reverse Polish notation, where the stack is supplied with data, and then a process is specified to perform on the data. The stack holds elements which primarily consist of three data types: Strings, MUCK Database References (hereafter referred to as dbrefs), and Numbers. Strings are used to process input from and output to the program user; dbrefs are references to indexes within the MUCK database, which allow the code to affect objects/things/players within the MUCK itself; and to clarify the last data type, originally MUF could only accept integer math, however recently floating-point support has been written into the language.

On the stack these three data types can be differentiated by their appearance, strings are surrounded by quotation marks ("Three Thousand"), dbrefs are indicated by prefixing with a pound sign (#3000), and numbers as the number itself (3000).

Code Terminology

The code itself is structured around a 'Word' which is composed of 'Primitives', which is analogous to saying 'routines composed of procedures' as a Word represents a subroutine that can be called by other Words. Each Primitive performs a specific operation, such as recalling or storing information, converting data types, utilizing data on the program stack to perform conditional logic, or sending messages to users online. Used together the primitives form the code which makes up a routine.

Online, the command MAN PRIMITIVES is used to display a list of the commonly used primitives. Each primitive's action is described separately in its own detail page, accessed by the MAN command. Along with the description of the primitive, a short string is provided that describes the primitives 'rule', or how it will affect the program stack. The rule is usually shown in the form of ( x1 x2 .. -- y1 y2 .. ) where text to the left of the double dash mark indicates data and the order it must be placed on the stack before that particular primitive can be used. Text to the right of the double dash indicates data objects that will be returned back to the stack once the primitive has completed its operation.

Hello, World

The standard "Hello World" program would look like this:

: HelloWorld
me @ "Hello World" notify
;

A colon sign followed by the Word's name is used to indicate the beginning of a Word, and the end of a word is indicated by use of a semicolon. The code does not require that the first Word be called Main, as it will begin processing from the last word of the program.

: HelloWorld (Second Routine)
me @ "Hello World" notify
;

: Initialization (First Routine)
HelloWorld (Jump to the Second Routine)
;

Also see

Example Usage of MUF

muflihsan: ya ni nik..btuh bangej.,cucian dah mnumpuk tuh..:-PRT @menikniiih: Btuh aq ya MUF..hahaa RT @@MUFlihsan: butuh seseorang.,hahay
MrRdnFly: @OGOchoCinco @SicilyJohnson I Wish A MUF*cka (WAMW) Would tell me my money isn't in the bank
moegatari: @MUF_MUF_MUFfler 食べる事って私にとって、BLと並ぶくらい至福なんです!皆と囲む食事、ちょっと贅沢な一品とか、もうわくわくしちゃう。だからつまんないメニューだとテンション下がるんですよねぇ。
Copyright 2009 WordIQ.com - Privacy Policy  :: Terms of Use  :: Contact Us  :: About Us
This article is licensed under the GNU Free Documentation License. It uses material from the this Wikipedia article.