Flij

From Esolang
Jump to navigation Jump to search

Flij is an esoteric programming language that takes place on an infinite tape of binary values with only one instruction of which the name of the language comes from: FLip, If was 1 Jump.

The binary values, which can be called "cells" or "bits", are referenced by integers, and each instruction is given a nonnegative integer. Negatively indexed cells are inputs in that the user can flip any of them. All cells are output bits in that they can be viewed at any time by the user. Cell 0 is randomised before every instruction, and nonzero cells start at state 0 at the beginning of the program. The first instruction is instruction 0. Programs halt when the end of it has been reached (halting also triggers if you jump past the end of the program).

Here, instructions will be notated as bit-to-flip,jump-to-this and seperated by ;, but note that the specific separators are up to the interpreter. It is also standard practice to put the instruction number as the jump number if it doesn't matter.

Interpreters

Desmos, my favorite programming language

Basic programs

Truth machine/cat program (assuming input is on -1 and has been done before the program began):

 -1,2;-1,3;1,3

Since output acts differently, data copying is also how a truth machine would work. Thus, the programs are the same.

Hello world (assuming every 7 bits after bit 0 are used to create ASCII characters):

 1,0;4,1;8,2;9,3;12,4;14,5;15,6;16,7;18,8;19,9;22,10;23,11;25,12;26,13;29,14;30,15;32,16;33,17;34,18;35,19;37,20;43,21;44,22;45,23;47,24;48,25;49,26;50,27;51,28;53,29;54,30;55,31;56,32;57,33;58,34;59,35;62,36;64,37;65,38;67,39;68,40;71,41;72,42;75,43;79,44;84,45

Logic gates AND on inputs on -1 & -2 to 1:

 1,0;-1,2;-2,3;-1,7;-2,7;-1,5;-1,8;1,7