[MUD-Dev] Properties of computer languages

Jon Leonard jleonard at frost.slimy.com
Thu Jun 17 02:17:52 CEST 1999


On Wed, Jun 16, 1999 at 10:31:47PM -0700, Caliban Tiresias Darklock wrote:
> 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.

The simplest list I'm aware of is:
1) Increment variable
2) Decrement variable (but not below 0)
3) Do block of code while variable != 0.

That's enough for Turing completeness...  There's lots of other sets of
operations that give Turing completeness, and many of them are more useful.

I suspect you're asking the wrong question, though.  Most of these minimal
systems are interesting only from a theoretical perspective.  They tend to
be a nightmare to program in, and terribly inefficient.  Who wants to use a
system where the simplest way to copy a variable uses three while loops?

It sounds as if you're trying to trying to design a simple (and yet usable?)
macro language...  I'd guess you may have other unstated constraints like:

* It should run reasonably efficiently
* It should be easy to understand even for non-CS majors
* It should be easy to implement

It might be a better idea to look at existing computer languages that have
small implementations (BASIC, Forth, Scheme, etc.), and then pick primitives
from those that seem like good ideas.  If it seems expressive enough, it
probably is...  There are essentially three classes of languages, roughly:
1) Way too primitive (Can't do anything interesting)
2) Primitive recursive (Can't do infinite loops, Ackermann's functions, etc.)
3) Turing complete (Can do anything any other language can)

Depending on what you're using macro languages for, a primitive recursive
language may be expressive enough, and has the advantage of never going into
infinite loops.  These can have for loops as long as the loop count is known
before entering the loop -- primitive recursive languages can do most of what
you might want to do.

I have a number of references at hand if the theory of computation stuff
is interesting.  My favorite is _Introduction to Automata Theory,
Languages, and Computation_ by John E. Hopcroft and Jeffrey D. Ullman.

If you look at this as a usability exercise, then I'm probably not of much
further use.  I like Scheme and Forth, which implies that most of my usability
opinions are suspect.

Jon Leonard



_______________________________________________
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