Flow Uncontrolled
Flow Uncontrolled is a language that requires self modification to do pretty much anything.
Arguments
The language has three instructions, written like Python function calls. The instructions all have at least 1 argument.
Arguments can be strings, numbers, nil, read(x), cln(), or rand().
strings can have escaped quotation marks (\"), and now we need an escaped backslash (\\). read(x) returns the contents of line x. cln() returns the line # currently being run. rand(x, y) returns a random number between x and y.
Operations
The operations in the language include + and -, which only works if both sides are numbers; and concatenation(&), which works on any data type. Boolean operations include =, >, >, and !=(not equal)
Instructions
The two instructions that write lines both overwrite the lines.
Instruction | Action |
---|---|
out(x, y) | Output the contents of line number x. If y is "Y" (without quotations), print with a newline. |
input(x) | Take a line of input and write it to line x |
write(x, y, z,) | Write y to line x if z evaluates to true. (z is optional, if it is not there the write will be unconditional) |
| | begin one-line comment |
If you need multiple commands on one line, separate them with a colon.
Examples
Quine
out(1)
Hello World
write(1, "Hello, World!") out(1, N)
Truth-machine
input(1) | overwrites itself with the input write(cln() + 1, read(cln()), read(1) = 1) : out(1) out(1, N)
Cat program
| input here input(1) : write(cln() + 1, read(2), read(1) != nil) : out(1)
A+B problem
The two values must be placed on separate lines in STDIN due to how input() works
| A gets placed here input(1) : input(3) | B overwrites this line write(4, read(1) + read(2)) | result overwrites this line out(4, Y)
99 bottles of beer
write(1, 99) | place the amount of bottles write(2, " bottles of beer on the wall,") | place all of the lyrics write(3, " bottles of beer.") write(4, "Take one down, pass it around,") write(5, " bottles of beer on the wall.") write(6, "1 bottle of beer on the wall,") write(7, "1 bottle of beer.") write(8, "No more bottles of beer on the wall.") | begin the printening write(cln() + 1, "out(1, N) : out(2, Y) : out(1, N) : out(3, Y) : out(4, Y) : out(1, N) : write(1, read(1) - 1) : out(5, Y) : out(9, Y)", read(1) > 1) : write(cln() + 1, "out(6, Y) : out(7, Y) : out(4, Y) : out(8, Y)", read(1) = 1) : write(cln() + 2, read(cln()), read(1) > 0)