ORK
Objekts R Kool. Every operation, even adding two numbers, is a request to an object, written as an English sentence.
Gregor Richards, 2005 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 4 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
Gregor Richards made ORK in 2005 as, in the words of its spec, the polar opposite of brainfuck. A program is a set of class definitions and a main part, all in sentences. There are no operators at all. To add, you hire a mathematician, give it a first and a second operand, tell it to add, and read its result. To print, you need a scribe; to read, an inputter; to compare words, a linguist.
Read the story
When this program starts:
There is a scribe called Writer.
Writer is to write "Hello, world!"
Classes are described the same way. There is such a thing as a counter. starts one, A counter has a brain which is a mathematician. gives it a member, and A counter can count. declares a method, which When a counter is to count: then defines. I am to loop jumps back to the start of the method, and If brain says it's greater then … tests a flag.
The machine
| Sentence | Does |
|---|---|
There is a T called N | A local object, word or number |
X is Y X's Y is Z | Assign, also to a member |
X is to F [Y] I am to F [Y] | Call a method on X, or on this object |
If X says it's equal then … | Test one of an object's flags |
I am to loop I am to quit | Run the method again from the top; stop the program |
A X has a Y which is a Z A X can F a T | A member; a method taking a word, number or object |
The built in classes are the scribe (write, asciiWrite), the inputter (read a word or number, readOne a character, it's done at the end), the mathematician (operands, add subtract multiply divide modulo compare floor, result) and the linguist (concatenate, compare), plus word and number arrays.
Try It Online runs ork.c, which turns every sentence into a line of C++ and has the result compiled. This implementation reads the sentences the same way and refuses what the C++ compiler would refuse, so such a program prints nothing. That catches a few programs on the esolangs.org page. Its truth machine defines methods its class never declares, its quine passes a quoted string where a method expects a variable and has a number called char, and its Deadfish interpreter has a member called register. char and register are C++ keywords. The truth machine below has the missing declarations added.
Example
The second program reads one character and writes it back.
The second program reads one character and writes it back. The third divides 10 by 4 the long way. This counter counts down from 3.
There is such a thing as a counter.
A counter has a brain which is a mathematician.
A counter has a voice which is a scribe.
A counter can count.
When a counter is to count:
voice is to write brain's first operand.
brain's second operand is 1.
brain is to subtract.
brain's first operand is brain's result.
brain's second operand is 0.
brain is to compare.
If brain says it's greater then I am to loop.
When this program starts:
There is a counter called c.
c's brain's first operand is 3.
c is to count.
Patterns it teaches
- Camouflage: an ordinary object-oriented language, classes, members and methods, disguised as plain English, like ArnoldC disguises its keywords as film quotes.
Try this
- Print the numbers 1 to 10, each on its own line (
asciiWrite 10prints a newline). - Read two numbers and print their sum.
- Hard: Deadfish, with the member renamed from
register.
Further
- esolangs.org/wiki/ORK
- The translator and its library, as Try It Online runs them
See also
Object-oriented paradigm
Pseudonatural
Write your own in Run Convert a program from ORK
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: ork.
Command line
shib run ork -e 'When this program starts:
There is a scribe called Writer.
Writer is to write "Hello, world!"'shib manual orkSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/ork.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org