DisFuck

From Esolang
Jump to navigation Jump to search

DisFuck is a combination of brainfuck and Dis languages designed by User:Tpaefawzen in 2025.

Overview

Data type is unsigned integer 0-59049; stored to registers and/or memory cell.

Has registers A, C and D.

A is accumulator.

Has program memory tape. Stores commands. Supports arbitrary length of comamnds. Iterated by register C.

Has data memory tape with data size of at least 65536 cells. It should wrap around. Iterated by register D.

8-bit-unit I/O. Possible exit statuses include: Ok, ProgramCounterTooFar, NoMatchingBrace.

Source file is list of commands. Every command character except in comment (surrounded in ( and ); comments cannot be nested) is set to program memory. Every non-command character is ignored. Interpretation procedure is as follows; assumes memory is 0-indexed:

  1. Load program to program memory. Set its length. Set A,C,D to zero. Set every cell in data memory to zero.
  2. If C==program.length then exit with status Ok.
  3. If C>program.length then it is implementation-defined to exit with status Ok or ProgramCountTooFar.
  4. If C<program.legnth let my_char := program[C].
  5. Do what content of the list of commands does for my_char.
  6. Go to step 2.

The commands are as follows:

List of commands
Character Command
! Exit with status Ok.
* D := dataMem[D]. Increment C.
^ [Commands 1] C := dataMem[D]. DON'T increment C.
> Increment D. A, dataMem[D] := rot(dataMem[D]). Increment C.
< Decrement D. Increment C.
+, - Increment/Decrement dataMem[D] to 33,42,62,94,95,123,124,or 125.

For example if dataMem[D] was 0-32 then increment to 33; 33-41 to 42; and so on; 125-59048 to 33. Increment C.

[ (CODE) ] [Commands 2] Set C to next character of [ if dataMem[D]%256 is not zero; or next character of ] otherwise.
[, ] when no matching brace is found Exit with status of NoMatchingBrace if dataMem[D]%256 isn't/is zero. Otherwise increment C.
_ Increment C and D.
., { If dataMem[D]/A is 59048 then exit with status Ok. Else cast such value to an octet and output it. Increment C.
| A, dataMem[D] := opr(A, dataMem[D]). Increment C.
,, } Get an octet. Store the value to dataMem[D]/A. If the input was EOF store 59048 instead. Increment C.
  1. Since dataMem[D] shall have in the range of 0-59048, C won't be set to >=59049.
  2. Resolved inside first.

This language has no explicit NOP command.