Wouter's FALSE
Implementation of programming language FALSEImplementation of FALSE programming language, created by the language’s author Wouter van Oortmerssen in 1993. Includes a compiler written in 68000 assembly and an interpreter written in C.
Links:
Examples:
Hello, World!:
Example for versions Morphett's FALSE, Wouter's FALSE 1.2.CFA string is equivalent to a command which simply prints it. There’s no way to put the string on the stack, except for as a part of a function.
"Hello, World!"
Factorial:
Example for versions Morphett's FALSE, Wouter's FALSE 1.2.CFThis example uses iterative method of factorial calculation. Variables i
and f
store current number (loop counter) and current factorial value. After the variables are initialized, the loop starts. [i;17=~]
defines the continuation condition: as long as i
doesn’t equal 17. Loop body follows: i
and a string constant are printed, i
is incremented, old value of f
is printed and new value of f
is calculated.
For Wouter’s FALSE 1.2.CF factorial values for 13 and above are calculated with overflow error.
0i: 1f:
[i;17=~]
[i; $."! = " 1+$i: f;$.10, *f:]
#
Fibonacci numbers:
Example for versions Morphett's FALSE, Wouter's FALSE 1.2.CFThis example uses iterative method of calculating Fibonacci numbers. Variables a
and b
store current numbers, variable i
is loop counter.
The second loop empties the stack (deletes Fibonacci numbers written there by the first loop). Some interpreters tolerate data left in stack after program completion, but Wouter’s FALSE requires that the stack is empty and throws a runtime error otherwise.
0i: 1a: 1b:
[i;16=~]
[a; $. ", " $ b; $ a: + b: i;1+i:]
#
"..."
[1=~]
[]
#
%
Quadratic equation:
Example for versions Wouter's FALSE 1.2.CFThis example is identical to the one written for Morphett’s FALSE, except that in Wouter’s FALSE end of input is signaled by end of line character, which is used for breaking the loop. Besides, % in the end of the code deletes the last leftover value from the stack.
1_s: ^
[$10=~]
[ $$ 96> \123\> & [32-]?
$$ 64> \91\> & $l: [s;~[32+]? , 0s:]? l;~[1_s: %]?
^]
#
%
Comments
]]>blog comments powered by Disqus
]]>