from armchair_progamer@programming.dev to programming_languages@programming.dev on 29 Apr 2024 21:35
https://programming.dev/post/13432947
Befreak is a purely reversible two-dimensional programming language. It was inspired by the Chris Pressey’s Befunge programming language. Like Befunge, all Befreak instructions are written as a single character, and execution can flow north, south, east, and west.
The thing that makes Befreak special is its reversibility. Every instruction in Befreak is by its very nature reversible. At any point during execution, if you’d like, you can pause the system, toggle the “reverse” flag, and then upon resuming, the program will run itself backwards from its current state, eventually ending up at the very beginning, where it started. This feature is not accomplished by keeping a history of past states, but simply by virtue of the fact that each individual instruction is reversible. This means that Befreak contains no instructions that can destroy information; this can make programming in the language both challenging and interesting.
Example program (prints prime numbers):
/1)@(1\ >)1=1(< \'(v?)/ >'%s(\ ^ >*s)=/ >=< ( /s'0v^?w23(v`s]:(48\ [ ( ) + ) = = 4 0 c c 8 1 = = ) % ) ( w \01(^ ^)01*01(/
threaded - newest