You can edit almost every page by Creating an account. Otherwise, see the FAQ.

FlipJump

From EverybodyWiki Bios & Wiki




Script error: No such module "Draft topics". Script error: No such module "AfC topic".

FlipJump
ParadigmEsoteric, imperative
Designed byTom Herman
First appearedJanuary 2021:[1]
Typing disciplineTypeless
Filename extensions.fj
Website{{#property:P856}}
Influenced by
Subleq, BitBitJump
Influenced
AddJump[2]

Search FlipJump on Amazon.

FlipJump is a 1-instruction language, That can do modern computation.

As the name implies - It Flips a bit, then Jumps (unconditionally). The fj op has 2 operands:

a;b

a and b are both addresses of bits, and it is equivalent to:

not *a; jump b

The flipjump prrogram starts executing from address 0.
It halts on a simple self-loop (jumps to itself, while not flipping itself).
The fj CPU has a built-in fixed memory-width.

The Assembly Language[edit]

The FlipJump Language syntax options[3]

  • Supports labels, padding.
  • Supports constants, mathematical & lofical expressions.
  • Syntax sugar (F;J | ;J | F; |  ;)
  • Flipping a whole word (`wflip`).
  • Macros & Repeatitions
  • Namespaces, Padding
  • Segments & Reserve

Variables Implementation[edit]

A bit can be implemented using 1 fj operation[4]. Specifically, ;0 for the value 0, and ;dw for the value 1 (dw is defined in the standard library as 2*w).

The FlipJump operation inherently can't read, nor write. Yet, it can jump to an already flipped address. That way it can execute an already modified code.
The bit variable is implemented based on this exact point. Jumping to a bit "fj op" while it's ;0 will jump to the first op in the program, while jumping to this bit "fj op" while it's ;dw will jump to the second op in the program (as it's 2w after the first op). In that way the variable can be "read", as it will execute different addresses based on its values.

Writes are Based on reading. To write "1" into a bit variable, you can read it's value, and in address that gets executed on the "value=1" case - just Flip the log2(dw) bit in that variable, to make this op ;0 again.

In that same way, Hexadecimal variables are implemented in a single op.
Instead of two options (;0 or ;dw), it will have 16 options (0dw,1dw,2dw,3dw,...,15dw).

Input / Output[edit]

Output[edit]

Output is done by flipping a special address.

2*w;    => will output 0
2*w+1;  => will output 1

To output an ASCII character - output the 8 bits of it in lsb-first order.

Input[edit]

The next input bit is always loaded at address 3w+log(dw), reloaded with each time it's read.
Jumping to ;dw will "read" the input bit, and will jump according to its value (as it's value is in the jump-part of the fj-op we jumped into).

To input/output an ASCII character - input/output the 8 bits of it, in lsb-first order.

The Standard Library[edit]

An extensive collection of documented macros, called the STL (STandard Library), was implemented in the FlipJump repository[5][6].

The STL contains:

  • input/output macros
  • bit variables, hex variables (also vectored macros)
  • mathematical macros (++, --, +, -, *, /)
  • logical macros (&, |, ^, !, <<, >>)
  • conditional branching
  • casting dec/hex/bit
  • pointers, functions, read/write memory.

Note that the hex macros are faster than the bit macros. They are based on lookup-tables, which are defined in init macros, such as hex.init..[7].

The .fjm Format[edit]

The FlipJump program (a collection of .fj files[8]) is compiled into a .fjm file[9].
The .fjm format has 4 versions[10], and its purpose is to hold all the memory segments and their data. In some versions, the data is compressed.

Examples[edit]

Take a look at the next (64bit) program:

1000;256  // addresses 000-127
32;446    // addresses 128-255
128;256   // addresses 256-383

The CPU starts executing at address 0, so it will flip the 1000th bit and will jump to address 256.
The CPU now executes the op 128;256, so it will flip the 128th bit (so, the 2nd op will be overridden to 33;446) and will jump again to address 256.
The CPU will get stuck in a self-loop here, as it jumps back to 256 forever.

Hello World[edit]

Using the stl (source):

startup
output "Hello, World!\n(:"
loop

There is also an example without standard library macros.

Quine[edit]

A quine (a program that prints itself) in flipjump: source, fully documented.

Printing Primes[edit]

A flipjump program that prints all the prime numbers up to a given input number.

World in FlipJump|Hello World

More programs are a simple calculator, and a bubble-sort program.

The FlipJump Repository And Package[edit]

Multiple Open source interpreters are available[11][12][13], as well as a flipjump assembler and the standard library[14]. There is also a python package that exports that as a command line tool[15]

Mentions[edit]

FlipJump has influenced multiple projects, such as a new language[16], compilers from flipjump[17], compilers to flipjump[18][19], and a binary protocol[20]

External resources[edit]

See Also[edit]

References[edit]

  1. "Standard library skeleton, conventions · tomhea/Flip-jump@19f3d28". GitHub.
  2. "AddJump - Esolang".
  3. "FlipJump - Esolang". esolangs.org. Retrieved 2023-12-12.
  4. "FlipJump - Esolang". esolangs.org. Retrieved 2023-12-12.
  5. "flip-jump/flipjump/stl at main · tomhea/flip-jump". GitHub. Retrieved 2023-12-12.
  6. "FlipJump - Esolang". esolangs.org. Retrieved 2023-12-12.
  7. "FlipJump - Esolang". esolangs.org. Retrieved 2023-12-12.
  8. "FJ File - What is an .fj file and how do I open it?". fileinfo.com. Retrieved 2023-12-12.
  9. "FJM File - What is an .fjm file and how do I open it?". fileinfo.com. Retrieved 2023-12-12.
  10. "flip-jump/flipjump/fjm/fjm_consts.py at main · tomhea/flip-jump". GitHub. Retrieved 2023-12-12.
  11. Tom (2023-12-02), FlipJump, retrieved 2023-12-12
  12. Tom (2023-11-30), FlipJump C++ Interpreter, retrieved 2023-12-12
  13. m, barsky (April 23, 2021). "flipjump interpreter in Rust". GitHub.
  14. Tom (2023-12-02), FlipJump, retrieved 2023-12-12
  15. Herman, Tom, flipjump: The single instruction language - Flip a bit, then Jump, retrieved 2023-12-12
  16. "AddJump - Esolang". esolangs.org. Retrieved 2023-12-12.
  17. Michel, Vincent (2023-08-24), Marbles, retrieved 2023-12-12
  18. Tom (2023-11-25), bf2fj, retrieved 2023-12-12
  19. Tom (2023-12-12), c2fj, retrieved 2023-12-12
  20. lestrozi (2023-11-08), pipevm, retrieved 2023-12-12


This article "FlipJump" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:FlipJump. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.