Flip is an esoteric programming language originally designed and implemented in 2001 by Rune Zedeler and Erik Søe Sørensen. The official home page of Flip is http://www.daimi.au.dk/~eriksoe/Flip/[1]. It is a two dimensional language in which multiple balls, each holding a 32-bit integer, roll around a grid, interacting with various elements in the grid. Here is a fairly concise "Hello, World!" program based on an octal encoding.
\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ PQ \,\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ + \ @ /+*</ / \/- @101154145145175045004172175126145144014021- @8@8@ @ X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</ \ < < \< /- \ \/ @ @
A full description of the language can be found at the Flip homepage (link above) as well as an interpreter (in Java), although this interpreter lacks two features which are mentioned in the description; input and levels. I have written two interpreters of my own which support all features of the language. The older, C++ version can be found at my downloads page. The newer interpreter is in Javascript and runs within a web browser. It is used in the following pages:
- All sample programs from the Flip language description
- All programs from the Flip homepage's collection
- Some of my own programs
- Editor to write your own programs or run programs copied from elsewhere
The interpreter itself can be found here.
The programs I've written in Flip include:
- The Hello, World! program shown above.
- A quine (self-replicating program).
- HELLO! and Hello, World! 'tickers'. These programs produce no output, but display the relevant phrase moving across the screen as part of the execution. A C++ program is available to create such effects; it reads a text file as the image to reproduce and outputs a flip program to display it.
- A program which prints the lyrics to "99 bottles of beer". This is particularly fun to watch in action (which you can do from the "Some of my own programs" link, above).
- The prime number calculator included in "Some of my own programs" has a breakdown of how it works.
- My solution to the small input of GCJ 2017's qualifying problem Oversized Pancake Flipper.
- Here is a brainfuck to Flip transpiler. It has two modes.
- The original version (designed in 2012 and available with
--v1
) produces more compact Flip code, but is usually slower to execute. Runtime is typically dominated by O((number of<
or>
instructions executed) × (program length)). This representation uses a pair of explicit stacks using levels to hold the tape. - The new version (designed in 2023 and available by default or with
--v2
) produces (usually) faster results, with a runtime of O(number of BF commands executed) steps of Flip, but is O((number of BF commands executed) × (number of memory cells visited)) complexity for the interpreter. This representation has the entire tape respresented by balls at levels and delays according to their distance from the current head.
- The original version (designed in 2012 and available with
[1]Link to web archive since the page is no longer accessible.