Malfunge
Jump to navigation
Jump to search
Malfunge is an esoteric programming language created by User:ArthroStar11 heavily inspired by Befunge and Malbolge
Data Structure
The data structure of Malfunge is an array of 5 stacks of 32-bit signed integers each with a max size of 1000
Playfield
Much like Befunge, Malfunge uses a playfield of fixed size. In the case of Malfunge the playfield is a 256 x 256 table of characters.
Command List
Flow Control
Important note: for brevity this section will mention "h-cond" and "v-cond" these represent behaviors identical to Befunge's _ and | respectively
- Retroreflectors (
<,>,^, andv)- if approaching from the concave side (i.e from the left with "
>) will invert the direction of the program (i.e. left for>) - if approaching from the sloped sides (i.e from above or below with
>) will send the program in the direction of the point (identical to Befunge) - if approaching from the pointed side (i.e from the right with
>) will perform a v-cond if retroreflector is pointing horizontally, h-cond otherwise
- if approaching from the concave side (i.e from the left with "
- Paddles (
|and_)|will invert the direction if approaching from the left or right, performs an h-cond otherwise_will invert the direction if approaching from above or below, performs a v-cond otherwise
- Mirrors (
/and\)- will reflect the direction 90 degrees represented visually by the mirror (behaves identically to AsciiDots)
- Misc
?changes the direction randomlyoskips the next command in the direction of the pointer
Math
- numbers (
0to9)- pushes the corresponding number to the current stack
- Operators (
P,M,T,D, andm)- pops a then b off of the current stack then pushes b(op)a onto <(current stack + 1) % 5>
PaddsMsubtractsTmultipliesDdividesmperforms modulo
- pops a then b off of the current stack then pushes b(op)a onto <(current stack + 1) % 5>
Stack Control
Sshifts to the next stack upsshifts to the next stack down
I/0
on current stack
- user input
,pushes user input as a character.pushes user input as an integer
- output
;pops value as a character and prints:pops value as an integer and prints
Misc
"toggles string mode (identical to Befunge)Ipops a then b off the current stack then pushes 1 if b>a, pushes 0 otherwiseipops a off the current stack then pushes 1 if a == 0, pushes 0 otherwisedduplicates top value@ends the program
Sample Programs
Hello World
0"!dlrow olleh"o>d;v
> <
@
Truth Machine
.o>dd:v > < @
Cat Program
An infinitely repeating cat program is implemented in the following:
o>,;v ^ <
Implementation
ArthroStar11's Interpreter (C source) (dead link)
Common Lisp implementation of the Malfunge programming language.