Zero Instruction Set Computer

From Esolang
(Redirected from ZISC)
Jump to navigation Jump to search

Zero Instruction Set Computers are a class of languages similar to OISCs, but even more restricted.

Explanation

A typical program in a "normal" assembly language (and to some extent, even non-assembly languages) consists of code, which operates on data. The code is normally made up of a sequence of commands/instructions, and typically, most of those commands will take arguments.

The OISC (One Instruction Set Computer) concept maintains this construction. However, it only has one sort of instruction/command, which is therefore entirely defined by its arguments (the command itself does not need a name and can be implicit, as there's only one possibility). Most OISC commands are moderately, but not excessively, complex, and typically take many arguments. OISCs also commonly use techniques such as self-modifying code and memory-mapping important registers, in order to gain more functionality from their instruction.

A ZISC takes this concept to its extreme. In addition to having only one command, that command takes no arguments (it represents the language's "ZISC operation", that can operate in the absence of any extra specification). As such, any program necessarily consists of that one command repeated indefinitely; any two programs are thus equivalent, and in fact the program itself is entirely implicit. In order to program in a ZISC, you obviously cannot write the program; instead, you initialize (all, or some subset of) memory.

Pretty much any language which reads commands from memory can be interpreted as a ZISC (with a very complex operation that decodes a command and handles a large number of possibilities). This is easiest to see using OISCs as an example. For example, ByteByteJump, when interpreted as an OISC, has command *b = *a; goto *c;. The ZISC interpretation of the language is more complex, as it has to include the semantics of fetching a memory-mapped instruction from memory: with a 3-word-per-address configuration, its ZISC operation is:

*(ip[3] * 65536 + ip[4] * 256 + ip[5]) = *(ip[0] * 65536 + ip[1] * 256 + ip[2]); ip = ip[7] * 65536 + ip[8] * 256 + ip[9];

Typically, a language that was designed as a ZISC would have a much simpler operation.

Advantages of ZISCs

OISCs are a common choice for interpreter golf competitions, because only needing to implement one instruction keeps the size of the interpreter low. However, they suffer somewhat from needing to handle the code and data separately (even if they are in the same physical memory array, you nonetheless tend to need separate registers for handling the instruction pointer and for handling any data being manipulated). A ZISC arrangement simplifies the problem still further, because there is no longer any need to keep track of command arguments. (However, it can make programming more complex, as the data itself has to encode rules for operating on that data.)

Examples