Falsish
FALSE with a stack of stacks, after ><>. Each new stack brings its own variables.
McChuck, 2022 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
McChuck made Falsish in 2022 as a superset of FALSE, inspired by ><>. Old FALSE programs still run, except for the ones that use FALSE's inline 68000 assembly. The backquote that FALSE kept for assembly now gives the next character a second meaning. `/ divides as floats, `"text" pushes a string where "text" prints one, and a backquote before a space leaves the running lambda.
Read the story
The biggest change is the stack of stacks. 3( moves the top three items onto a new stack, and its own variables a, b and c start as those three items. ) drops that stack and moves whatever is left on it back down. Lowercase variables belong to a stack; uppercase ones are global.
The machine
| Char | Does |
|---|---|
123 'c `1.5 | Push an integer, a character code or a float | |
$ % \ @ | Dup, drop, swap, rot |
ø © ™ £ ® | Pick, put, roll, over, reverse the stack |
+ - * / _ | Arithmetic; / rounds down, _ negates |
> = & \| ~ | Compare and bitwise, with -1 as true |
[...] ! | Push a lambda; run it |
? ¿ # ¶ | If, if-else, while; leave the nearest while loop |
a to z, A to Z, : ; | Local and global variables; store, fetch |
<"name" <name | Store into a named variable; push its name, or run it when it ends in ! |
N( ) | Start a stack with the top N items; drop it |
‡ § | Clear the stack; push its depth |
^ , . "text" | Read a character; write a character, a number, a text |
{...} | Comment |
Integers never overflow, and , writes strings, variable names and lambdas as well as characters.
Example
The factorial.
The factorial. =~ is = and then ~, so it reads as not equal.
The alternating reverse puts 0 to 10 on the stack and moves eleven items onto a new stack, the numbers 1 to 10 and an 11 that n: keeps as a counter. Each round prints the top and reverses the stack, so the two ends take turns. The 0 stays on the first stack and comes out last.
A named variable whose name ends in ! runs as soon as it is named.
Patterns it teaches
- Stack machines: one stack per scope, pushed and dropped like frames.
- Code as data: lambdas sit on the stack, and
`]turns one into a string.
Further
- esolangs.org/wiki/Falsish
- FALSE, the language underneath
See also
Stack-based
Write your own in Run Convert a program from Falsish
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: falsish.
Command line
shib run falsish -e '{Factorial}
[$1=~[$1-f;!*]?]f:
5$f;!
\"Factorial of "." is: ".10,'shib manual falsishSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/falsish.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org