AMiaBF’!?
One number, nine commands, and the only arithmetic besides adding is the derivative of a number.
AmNow, 2021 · Turing complete: unknown · ●○○ easy · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
AmNow made AMiaBF’!? in 2021 as a superset of !aBF', with a few changes. The whole machine is one integer accumulator that starts at 0. It can add 1 or 5, never subtract. Besides reading a number with ?, the one other way to change it is ‘, which replaces it with its arithmetic derivative, where a prime gives 1 and a product follows the product rule. Loops come from A and B, which work as brainfuck's brackets on the accumulator.
Read the story
The specification says a prints the accumulator in caps. Digits have no capitals, so it prints plain digits.
The machine
| Command | Does |
|---|---|
i F | Add 1; add 5 |
‘ | Replace the accumulator with its arithmetic derivative |
A | Skip past the matching B if the accumulator is 0 |
B | Jump back to the matching A if it is not 0 |
a | Print the accumulator as a number |
M | Print # |
? | Read an integer |
! | Skip the next command |
Every other character is ignored. The program FAMB prints # forever, as 5 never becomes 0.
Example
The truth machine on 0, and the derivative of 12.
The truth machine on 0, and the derivative of 12. As 12 is 2 · 2 · 3, its derivative is 12/2 + 12/2 + 12/3, which is 16.
The repeating cat prints each number it reads and stops after a 0.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from AMiaBF’!?
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: amiabf.
Command line
shib run amiabf -e '?‘a' --input '12'shib manual amiabfSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/amiabf.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org