[MUD-Dev] Properties of computer languages

Mark Gritter mark at erdos.Stanford.EDU
Thu Jun 17 02:19:45 CEST 1999


Caliban Tiresias Darklock 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.
> 

I don't have the document you refer to, but I can take a swing at answering 
your question.

In theoretical (rather than practical) terms, you need conditionals,
branching (or iteration), and arbitrarily large state.  An example of the 
last is an array--- just allowing multiple variables isn't sufficient, 
unless your values can be arbitrarily large.  (In which case you can
play number-theoretical games and implement an array using a single
variable.)

These can even be combined--- for example, Hennessy & Patterson give an
example of a one-instruction computer in their architecture textbook.
The presence of these features can be very subtle, too: "pure" untyped lambda
calculus has only one rule, substitution, but you can implement 
conditionals and recursion by being sufficiently clever.

The question to ask is "can I implement any given Turing machine in my 
language?"  If you can, your language is strong enough to implement any 
other programming language.

Practically speaking, though, you probably want to implement more than
the minimum, for efficiency.  So, rather than just getting by with
"increment" and "decrement" instructions (or "set to 0" and "set to 1"), 
most languages offer addition and subtraction, less-than and greater-than,
etc.  

Adding arrays or lists is generally the easiest way to make a language 
complete, although note that you have to implement dynamic arrays
to truly do so.  Staticly-sized arrays are no more powerful than some
proportional number of variables--- but in practice, you're limited
by the machine's memory anyway.

Mark Gritter
mark at erdos.stanford.edu



_______________________________________________
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