Befunge-93 Interpreter
Output:
No output yet.
Stack:
[ ] (Empty)
Status:
Ready
About Befunge:
Befunge is a two-dimensional esoteric programming language invented in 1993 by Chris Pressey. Code is laid out on a 2D grid (the "playfield"), and the instruction pointer can travel in any of four cardinal directions. It is a stack-based language, meaning most operations manipulate values on a single stack. Befunge was designed with the goal of being as difficult to compile as possible, primarily due to its self-modifying nature (the p
command) and multi-directional execution flow.
Befunge-93 Commands:
Cmd | Description |
---|---|
0-9 | Push this number onto the stack. |
+ - * / % | Arithmetic: Pop b, then a. Push a [op] b. |
! | Logical NOT: Pop a value. If 0, push 1; otherwise push 0. |
` | Greater than: Pop b, then a. Push 1 if a > b, else 0. |
> < ^ v | Change instruction pointer direction. |
? | Set a random cardinal direction. |
_ | | Horizontal/Vertical IF: Pop value. Go right/down if 0, left/up otherwise. |
" | Toggle stringmode (pushes ASCII values of chars until next "). |
: \\ $ | Stack manipulation: duplicate, swap, and pop (discard). |
. , | Output: pop value and print as integer or ASCII character. |
# | Bridge: Skip the next cell in the current direction. |
g p | Get/Put: Read/write character from/to the playfield at (x,y). |
& ~ | Input: Get an integer or a character from the user. |
@ | End program. |