vfl
FALSE, kept small and easy to build, then bent to its maker's taste.
Viba1, 2024 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 7 known programs · Test method
Run it
The idea
Viba1 made vfl, viba's FALSE-like, in 2024. It keeps FALSE's one-character commands on one stack, but the 26 letter variables become an unbounded array of numbered cells, a to z being the numbers 0 to 25. Lambdas stay, while if and loops become blocks written in place. Input and output go through numbered ports, and only ASCII is used.
Read the story
Values are 32-bit unsigned integers. True is all 32 bits set, so ~ is both bitwise and boolean NOT.
The machine
| Code | Does |
|---|---|
123 'c a-z | Push a number, a character code, or 0 to 25 |
$ _ \ @ | Dup, drop, swap, rot |
n? | Copy the item n down; 0? is dup |
v n: n; | Store v in cell n; fetch cell n |
+ - * / % | Arithmetic |
& \| ~ | Bitwise and, or, not |
= > < | Compare, giving all bits set or 0 |
{...} ! | Push a lambda; run it |
c(...) | Run the block if c is not 0 |
[...] ^ # | Loop forever; break; next round |
v p. p, | Write v to port p; read from port p |
p"text" | Write each character to port p |
Port 0 is a character and port 1 a decimal number. An if and else is c$(yes)~(no), and a while loop is [c~(^)body].
Example
k is 10, a line feed.
k is 10, a line feed. The truth machine reads a number from port 1. If it is not 0 it loops printing 1 forever; otherwise it prints 0.
The Collatz sequence without variables. $2%0=$(\2/\)~(3*1+) halves an even number and turns an odd one into 3n+1, using the if and else form.
The specification also has 99 bottles of beer, translated from FALSE, and a prime generator that never stops.
Patterns it teaches
- Stack machines: FALSE's model with numbered cells.
- Turing completeness:
$_\{}!alone matches a Turing complete part of FALSE.
Further
See also
Stack-based
Write your own in Run Convert a program from vfl
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: vfl.
Command line
shib run vfl -e '1,([b1.])a1.' --input '0'shib manual vflSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/vfl.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org