Befunge-96 and Funge-97 (MTFI)
The drafts between Befunge-93 and Funge-98, from one line up to seven dimensions, with a stack that can be worked from the bottom.
Chris Pressey, 1993 · Turing complete: yes · ●●● hard · esolangs.org
Tested with 7 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
Funge-98 did not come in one step. Befunge-93 led to Befunge-96, and that led to Funge-97, which already took the language from one dimension (Unefunge) up through Befunge, Trefunge and beyond. Funge-98 grew out of Funge-97 and dropped some of its ideas again.
Read the story
One idea that did not survive is a stack you can use from either end. Funge-97 has two switches. q turns on queuemode, in which pops come from the bottom of the stack, and i turns on invertmode, in which pushes go onto the bottom. With both on, the stack is used upside down. Befunge-96 does this with i alone. TIO runs all of these with MTFI, a combined Befunge-93, Befunge-96 and Funge-97 interpreter.
The machine
These implementations are a subset. They take the Funge-98 machine of Befunge-98 in 1 to 7 dimensions and add the stack modes as TIO's Hello World programs use them.
| Port | Space | Stack modes |
|---|---|---|
befunge-96-mtfi | a plane | i flips the stack end for end |
befunge-97-mtfi | a plane | q pops from the bottom, i pushes to the bottom |
unefunge-97-mtfi | a line | as Funge-97 |
trefunge-97-mtfi to septefunge-97-mtfi | 3 to 7 dimensions | as Funge-97 |
Everything else is Funge-98. The space has no edge and wraps round, g and p take a vector of as many numbers as there are dimensions, and [ ] turn in the plane of x and y. Funge-97's hovermode and switchmode are left out, and in three or more dimensions the pointer reaches the other axes only through x, which sets its whole delta.
Example
A string pushes its last letter on top, so a plain loop would print it backwards.
A string pushes its last letter on top, so a plain loop would print it backwards. In the Befunge-96 Hello World, i turns the stack over and the loop prints from H. The Funge-97 one turns on both modes, so : duplicates the bottom item and , prints it. Its ] turns the pointer north on a one-line program, which wraps straight back onto ] and turns it east again.
Further
- esolangs.org/wiki/Befunge, whose page "Befunge/96 and 97" keeps the original drafts and MTFI
- TIO's MTFI: github.com/TryItOnline/befunge-97-mtfi
See also
Self-modifying
Two-dimensional languages
Write your own in Run Convert a program from Befunge-96 and Funge-97 (MTFI)
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: befunge-97-mtfi.
Command line
shib run befunge-97-mtfi -e '68*,@'shib manual befunge-97-mtfiSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/befunge-97-mtfi.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org