naz

a JavaScript-based esolang where every instruction is named by a number and a letter

9a7m2a1o

input


instruction reference

0-9 - number literal. exactly one of these must be placed before every instruction.

a - adds n to the register.

d - divides the register by n, rounding down.

e - conditional equal to. goto function n if the value in the register is equal to the value of the variable referenced before this instruction.

f - function instruction:

g - conditional greater than. goto function n if the value in the register is greater than the value of the variable referenced before this instruction.

h - halts program execution. this is meant to be used for debugging purposes only.

l - conditional less than. goto function n if the value in the register is less than the value of the variable referenced before this instruction.

m - multiplies the register by n.

n - negates variable n.

o - outputs a value determined by the value in the register:

p - divides the register by n, then sets the register equal to the remainder.

r - sets the register equal to the ASCII value of the n-th character of the input string, then removes that character from the input string.

s - subtracts n from the register.

v - variable instruction:

x - sets the current opcode to n.

opcodes

0 - normal operation. instructions will execute one at a time, in order.

1 - function write. the interpreter must parse a call to the f instruction first; instructions will then be added onto the end of the referenced function until a newline is parsed or the opcode is explicitly set to 0.

2 - variable write. the interpreter must parse a call to the v instruction; after this is executed, the interpreter will return to opcode 0.

3 - conditional opcode. the interpreter must parse a call to the v instruction, followed by a call to a conditional instruction (l, e or g). afterwards, the interpreter will return to opcode 0.

notes

the value in the register must always be between -127 and 127 inclusive, or program execution will immediately halt.

conditional instructions can only be run in opcode 3.