Forte
LET 9=7, and from then on six times nine is forty-two.
ais523, 2006 · Turing complete: yes · ●●● hard · esolangs.org
Tested with 4 known programs · Hello World on Try It Online: identical except the line end · Test method
Run it
The idea
ais523 made Forte in 2006. It looks like BASIC, with numbered lines, PRINT, LET, INPUT. But LET does not set a variable. There are no variables. It redefines a number. After LET 9=7, every 9 in the program, and every 9 a calculation produces, means 7.
Read the story
Line numbers are numbers too. Forte has no GOTO; the line with the next higher number runs next. Redefine a line's number and the line moves, so a loop is a line that keeps moving itself, or a copy of itself, further down the program. The name comes from the mess this makes of the Peano postulates.
The machine
| Command | Does |
|---|---|
LET a=b | From now on the number a means the value of b |
PRINT e PRINT "text" | Print, with a newline unless the command ends in ; |
PUT e GET e | Print a character; redefine e to the code of an input byte (256 at the end) |
INPUT e | Redefine e to a number from the input |
REM | A comment, to the end of the line |
END | Stop; without it the program loops forever |
Expressions are numbers and (a+b), (a-b), (a*b), (a/b); brackets are compulsory except around the whole expression, since (1+2)+3 can differ from 1+(2+3). A colon separates commands on one line.
Example
In the second program, 6*9 first gives 54.
In the second program, 6*9 first gives 54. After LET 9=7 it gives 42, and after LET 42=20 the 42 it computes is itself redefined, so it prints 20. The long tour on esolangs.org, with its loop of moving lines, prints the same 22 Looping... as the specification describes.
Further
Ideas it shows
See also
Self-modifying
Write your own in Run Convert a program from Forte
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: forte.
Command line
shib run forte -e '10 GET 65
20 PUT 65
30 END' --input 'x'shib manual forteSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/forte.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org