Skiforth
Jump to navigation
Jump to search
Skiforth is a SK-calculus based Forth discovered by User:Orby in April 2020.
Definitions
S and K are combinators. If x and y are combinators, then x y ` is a combinator.
z y x S ` ` `is rewritten toz y ` z x ` `y x K ` `is rewritten tox
Words
All words must be separated by whitespace. All words are case insensitive. Skiforth uses post-fix notation. There are 10 built-in words including the ability to define new ones:
Spushes the S combinator onto the stack.Kpushes the K combinator onto the stack.`applies the first combinator on the stack to the second combinator on the stack.:begins a word definition.;ends a word definition..pops the first combinator off the stack and prints it.(begins a comment.)ends a comment.include fileincludes a file.listlists the content of the dictionary.byeexits the interpreter.
Examples
The I combinator (SKK) is not a built-in command. We can define it by typing
: I K K S ` ` ; ok
The first token after : is the name of the word. All subsequent tokens until ; compose the body of the word. Let's look at what we created
I . K K S ` ` ok
We can apply the I combinator to itself and print the result by typing
I I ` . K K S ` ` ok
We can also redefine built-in commands
: S K S ` ` ; ok
And redefine commands we've already defined recursively
: S K S ` ` ; ok : S K S ` ` ; ok S . K K S ` ` ok
See also
- Git (from the Wayback Machine; retrieved on 18 April 2021) repository for official Skiforth interpreter.
- Bootable ISO (dead link) which contains the Skiforth OS.
- Unlambda is similar but uses prefix notation.