[MUD-Dev] Properties of computer languages

David95037 at aol.com David95037 at aol.com
Thu Jun 17 05:41:53 CEST 1999


In a message dated 6/17/99 1:36:14 AM, caliban at darklock.com writes:

>I'm in the process of redesigning the macro language of my game, and I
>recall seeing at one time a list... a very short list... of things that a
>computer language absolutely required. Sort of a bare-bones "what you need
>to do everything you need to do in any given program". Two of the things on
>the list were conditionals (if/then/else) and iteration (for/next and
>do/while). There were either two or three other things listed, but I don't
>remember what they were. Does anyone here have a memory spark going off as
>to what list I'm talking about and where I can find it? I think one of the
>other things was something along the lines of subroutine/function 
declaration.

Godel, Escher, Bach: An Eternal Golden Braid by Douglas R. Hofstadter
covers this in chapter 13.

You basically have it.  Add simple arithmetic (+,-,*,/) and the ability to not
only check for equality but greater then or less then.  Of course, that all
assumes variables and assignment in the first place.  So i guess the list is:

Variables
Arithmetic
Assignment
Determining equality, inequality, greater then, less then
Branching
Looping fixed iterations
Looping open ended
Blocks of statements (so you don't have to push everything into a subroutine)
Subroutines (so that you don't have to repeat the same code over and over)

On the minimalistic side, you can do away with variables and just use a stack.
Postfix notation can eliminate the need for parentheses and operator
precedence.  If one macro can refer to another macro, you have defacto 
subroutines.  This can also be used to group blocks of statements.

I have a macro language in a tool where the "if" construct will execute the
rest of the macro if true, else terminate it right there.  My macro languages
have a tendency to be stack based RPN things.  My Forth days are showing
through.  If doing a stack based system, remember to include duplicates
and swaps at the minimum, and 3 value rotates are very useful.  I would be
happy to elaborate on this topic if anyone would find it useful.

--djk, keeper of arcane lore & trivial fluff



_______________________________________________
MUD-Dev maillist  -  MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev




More information about the mud-dev-archive mailing list