Befunge
Befunge is a two-dimensional stack-based, reflective, esoteric programming language.[src] It differs from conventional languages in that programs are arranged on a two-dimensional grid.[src] "Arrow" instructions direct the control flow to the left, right, up or down, and loops are constructed by sending the control flow in a cycle.[src] It has been described as "a cross between Forth and Lemmings".[src] Befunge was created by Chris Pressey in 1993 for the Amiga.[src] The language was designed to be as hard to compile as possible, featuring self-modifying code and a multi-dimensional playfield.[src] Despite this, several compilers have been written for the language.[src] The original Befunge-93 specification limited programs to an 80x25 grid, and while not Turing-complete, subsequent extensions like Funge-98 expanded the concept to achieve Turing completeness.[src] The name "Befunge" originated from a typing error in an online discussion.[src] While it was designed to be difficult to compile, compilers such as bef2c and Betty have managed to implement the language using various techniques.[src] Befunge programs are characterized by their use of arrows to change control flow, and they can produce outputs like random number sequences or classic "Hello, World!" messages.[src]
Befunge is a two-dimensional stack-based, reflective, esoteric programming language.[src] It differs from conventional languages in that programs are arranged on a two-dimensional grid.[src] "Arrow" instructions direct the control flow to the left, right, up or down, and loops are constructed by sending the control flow in a cycle.[src] It has been described as "a cross between Forth and Lemmings".[src] Befunge was created by Chris Pressey in 1993 for the Amiga.[src] The language was designed to be as hard to compile as possible, featuring self-modifying code and a multi-dimensional playfield.[src] Despite this, several compilers have been written for the language.[src] The original Befunge-93 specification limited programs to an 80x25 grid, and while not Turing-complete, subsequent extensions like Funge-98 expanded the concept to achieve Turing completeness.[src] The name "Befunge" originated from a typing error in an online discussion.[src] While it was designed to be difficult to compile, compilers such as bef2c and Betty have managed to implement the language using various techniques.[src] Befunge programs are characterized by their use of arrows to change control flow, and they can produce outputs like random number sequences or classic "Hello, World!" messages.[src] ==Etymology== The word Befunge is derived from a typing error in an online discussion, where the word 'before' was intended.[src] v>>>>>v 12345 ^?^ > ?[src] ?^ v?v 6789 >>>> v ^ .[src] The following code is an example of the classic "Hello World!" program.[src] First the letters "olleH" are pushed onto the stack as ASCII numbers.[src] These are then popped from the stack in LIFO order and output as text characters to give "Hello".[src] A space is character number 32 in ASCII, which here is constructed by multiplying 4 and 8, before being output as text.[src] The remaining code then outputs "World!" in a similar way, followed by ASCII character 10 (a line feed character, moving the output cursor to a new line).[src] > v v ,,,,,"Hello" 48*, v v,,,,,,"World!" 25*,@ The following code is a slightly more complicated version.[src] It adds the ASCII character 10 (a line feed character) to the stack, and then pushes "!dlrow ,olleH" to the stack.[src] Again, LIFO ordering means that "H" is now the top of the stack and will be the first printed, "e" is second, and so on.[src] To print the characters, the program enters a loop that first duplicates the top value on the stack (so now the stack would look like "\n!dlrow ,olleHH").[src] Then the "_" operation will pop the duplicated value, and go right if it's a zero, left otherwise.[src] (This assumes a compliant interpreter that "returns" 0 when popping an empty stack.) When it goes left, it pops and prints the top value as an ASCII character.[src] It then duplicates the next character and loops back to the "_" test, continuing to print the rest of the stack until it is empty and so the next value popped is 0, at which point "@" ends the program.[src] >25*"!dlrow ,olleH":v v:,_@ > ^ ==Befunge-93 instruction list== Most one-dimensional programming languages require some syntactic distinction between comment text and source code — although that distinction may be as trivial as Brainfuck's rule that any character not in the set +-[]<>,.[src] is a comment.[src] Languages like Lisp and Python treat strings as comments in contexts where the values are not used.[src] Similarly, in Befunge, there is no comment syntax: to embed documentation in the code, the programmer simply routes the control flow around the "comment" area, so that the text in that area is never executed.[src] ==See also== Brainfuck Carnage Heart – PlayStation programming game using a similar language INTERCAL Whitespace Malbolge Piet ==References== ==External links== Befunge-93 Specification Befunge-93 Reference Implementation Funge-98 Specification[src]
42 sentences · 42 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Befunge." encyclopegia.org, 2026, https://encyclopegia.org/wiki/befunge. Accessed 04 December 2026.
Chicago
"Befunge." encyclopegia.org. Accessed December 4, 2026. https://encyclopegia.org/wiki/befunge.
APA
encyclopegia.org. (2026). Befunge. Retrieved December 4, 2026, from https://encyclopegia.org/wiki/befunge
Accessed December 4, 2026 · CC BY-SA 4.0 · citation page · JSON