esolang

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

Expected: Hello, World!

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.

PortSpaceStack modes
befunge-96-mtfia planei flips the stack end for end
befunge-97-mtfia planeq pops from the bottom, i pushes to the bottom
unefunge-97-mtfia lineas Funge-97
trefunge-97-mtfi to septefunge-97-mtfi3 to 7 dimensionsas 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.
Expected: Hello, World!
Expected: cba
Expected: abc
Expected: Hello, World!
Expected: Hello, World!
Expected: Hi!
Expected: 17
Expected: 0
Expected: Hello, World!

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

Ideas it shows

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-mtfi

Source

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