Another Finite State Brainfuck

From Esolang
Jump to navigation Jump to search

Another Finite State Brainfuck is a Brainfuck subset by User:oshaboy designed to be equivalent to an FSA . Because the original Finite State Brainfuck could only check if an input is 1 or 0. Some say Brainfuck without < and > is an FSA but because it can do arithmetic it is more of a Push-down automaton that has a stack limit of 256 unary values.

Differences from Brainfuck

  • The < and > instructions were removed making one cell an accumulator.
  • The accumulator size was thus increased to a long long. (This doesn't help much)
  • . prints the value of the accumulator mod 256
  • The first + in any sequence of consecutive + sets the accumulator to 0 before incrementing
  • - doesn't underflow, attempting to use - when the accumulator is 0 is a NOP.
  • [ ] and , stay the same.

This means you can't count higher than the largest immediate in the program. Which makes it a lot more like a Finite State Automata where you keep count using your position in the code.

Examples

Truth Machine

,------------------------------------------------[+++++++++++++++++++++++++++++++++++++++++++++++++.]++++++++++++++++++++++++++++++++++++++++++++++++.

Implementation

https://github.com/oshaboy/Another-Finite-State-Brainfuck