dual tape

From Esolang
Jump to navigation Jump to search

dual tape is a "two" instruction tape machine. Every cell holds an instruction and a number.

About

About
Author Charles McMarrow
User User:Ch44d
Conceived 8/18/2021
Birthday 10/29/2021
Official Interpreter
pip install dual_tape
https://github.com/cmcmarrow/dual_tape

Instructions

Name Instruction Description
Next n Increment to the next rule and increment to the next instruction.
Execute x Execute the current rule.

Rules

Name Description
Halt Stop the program.
Out Number Outputs the number from item_1.
Out Character Outputs the number as a UTF-8 character from item_1.
In Number Read number from console into item_1. Falls back to 0 if error.
In Character Read UTF-8 character from console into item_1. Falls back to "\0" if error.
Add item_1 = item_2 + item_1
Subtract item_1 = item_2 - item_1
Jump pc = current value in memory
Jump Dynamic pc = value from memory address in item_1
Jump Zero pc = item_1 if item_2 == 0
Jump Greater pc = item_1 if item_2 >= 0
Read item_2 = item_1; item_1 = current value in memory
Read Dynamic item_2 = item_1; item_1 = value from memory address in item_1
Read Dynamic Instruction item_2 = item_1; item_1 = value from memory instruction address in item_1
Write current location in memory = item_1
Write Dynamic value from memory address in item_1 = item_2
Write Dynamic Instruction value from memory instruction address in item_1 = item_2 if item_2 is a valid instruction

Registers

Register Description
pc Holds the current program counter. At program start pc is set to the label "@". If Label "@" is not present an error will be thrown.
item_1 Set to 0 at program start.
item_2 Set to 0 at program start.
rule Set to Halt at program start. The Next instruction uses this register to cycle through all the rules in the order listed.

Memory

A single memory cell holds two items, instruction and data. The default instruction value is "n" and the default data value is 0. Memory range is negative infinity to infinity.

Syntax

Syntax
<CODE> ::= {(([LABEL] INSTRUCTION [LABEL | NUMBER | CHARACTER | COMMENT] [COMMENT]) | COMMENT | "") NEWLINE}
<LABEL> ::= "@" {Any UTF-8 Character excluding white space}
<INSTRUCTION> ::= "n" | "x"
<COMMENT> ::= "#" {Any UTF-8 Character excluding NEWLINE}
<NEWLINE> ::= "\n"
<CHARACTER> ::= "c" (Normal UTF-8 Character)
<NUMBER> ::= An Integer

Sister Language

dual_tape_ez

Programs

truth-machine

@ n # Truth Mach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