Finite-state mach... wait, WHAT!?

From Esolang
Jump to navigation Jump to search
Finite-state mach... wait, WHAT!?
Paradigm(s) Imperative
Designed by User:Hakerh400
Appeared in 2020
Computational class Unknown
Major implementations Interpreter
File extension(s) .txt

Finite-state mach... wait, WHAT!? (or simply FSMWW) is a programming language that looks like an FSM, but it can construct and execute another program, which can use more memory.


Same memory model as in brainfuck (8-bit cells), but the tape is limited (has finite number of memory cells).

Source code

The first character of the source code must be either : or ;.

Then a decimal number follows (sequence of decimal digits). That number (we call it N) represents the memory size (number of memory cells). Data pointer is at the cell with index 0 and the last accessible cell has index N-1. If the memory pointer goes outside the memory (becomes -1 or N), then throw an error.

The rest of the source code (after the number) is a brainfuck program. Execute it as a regular brainfuck code (but with limited memory). When (if) the brainfuck program halts, do the following:

  • If the first character of the source code is ;, then print the brainfuck output and terminate the whole FSMWW program
  • If the first character of the source code is :, then interpret the brainfuck output as a FSMWW program

Note: in case of :, the input is not reset (what has already been read remains read). Reading after the last input character gives 0.




Another one:


The second example generates the first example and then executes it.

Computational class