Talk:SMITH

From Esolang
Jump to: navigation, search

Esoteric Syntax

I'm writing a SMITH self-interpreter and a SMITH interpreter in brainfuck. To simplify these tasks, I have created a variation on the SMITH syntax. The SMITH commands are mapped to lower-case letters starting with "a". REP and * are not allowed. The command ordering is as follows:

MOV register, immediate         => a
MOV register, register          => b
MOV register, [register]        => c
MOV register, PC                => d
MOV register, TTY               => e
MOV [register], register        => f
MOV [register], TTY             => g
MOV [register], "string"        => h
MOV TTY, register               => i
MOV TTY, [register]             => j
SUB register, immediate         => k
SUB register, register          => l
MUL register, immediate         => m
MUL register, register          => n
NOT register                    => o
COR offset, offset, register    => p
COR offset, register, register  => q
BLA offset, NOP, register       => r
NOP                             => s
STOP                            => t

The following rules apply:

  1. Every instruction (with one exception) is followed by three hexadecimal numbers
  2. The first two hexadecimal numbers are signed by a preceding 0 for positive or a 1 for negative. The third is not.
  3. Hexadecimal numbers are exactly 4 digits and use uppercase A-F
  4. The values of the extra numbers for instructions that require less than three numbers will be ignored
  5. There is no whitespace between the numbers
  6. A single newline separates each instruction
  7. For the BLA instruction, NOP is 0 and STOP is 1

The only exceptional case is the

MOV [register], "string"

instruction which is followed by two unsigned 4-digit hexadecimal numbers and then by the string. The second number is the length of the string.

--Nthern 23:26, 6 August 2007 (UTC)