SMITH

From Esolang

Jump to: navigation, search

SMITH, for Self-Modifying Indecent Turing Hack, is an esoteric programming language designed by Chris Pressey in 2000. It has no jumps whatsoever; the instruction pointer can only be incremented, and only by one instruction at a time. As a substitute for loops, the language allows code to be copied forward where it will be executed in the future.

SMITH was designed for two purposes: as a more powerful descendant of SMETANA, and to one-up Bullfrog's partial lack of jump instructions.

SMITH# is a descendant of SMITH which comes closer to being a Turing tarpit.

[edit] Syntax and Semantics

Syntactically, SMITH resembles assembly code on a generic microcomputer. The specific syntax was loosely modelled after an imaginary register machine language described in "Compilers: Principles, Techniques, and Tools" (a.k.a. the "Dragon" book.)

From this starting point, however, SMITH fails to include any branching instructions. It makes up for this by adding the instruction COR, which stands for "COpy by Register". The purpose of COR is to provide a way to copy previously-executed instructions from the program into storage from which the program will be executed in the future. In this way, repetition of execution of code can still be achieved, despite the lack of branches.

Conditional repetition can be achieved via the single register operand of COR, which controls how many instructions are copied. If this value is zero, no instructions are copied; this can be used to simulate failing to meet a condition, especially in conjunction with the MUL instruction.

Since implementing a loop in SMITH requires only that part of the program is copied past the end of the existing program, the case of overwriting existing program contents with COR was not considered during design. This behaviour is therefore undefined (and happens to be implemented contrary to reasonable expectations in the current (2.0L) version of the reference interpreter.)

[edit] Computational class

SMITH should be Turing-complete. It imposes no limit on the number of registers, nor on the amount of information each register may contain. Also, copying (possibly zero-length) sections of already-executed code forward should be strictly equivalent to looping and branching in conventional programming languages. However, this has never been formally proved.

[edit] External resources

Personal tools