Category:Quackery: Difference between revisions
m
corrected external link to wiki link
mNo edit summary |
m (corrected external link to wiki link) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1:
{{language|Quackery}}
{{language programming paradigm|
{{language programming paradigm|
Quackery is an open
It is coded as a Python 3 function in under 48k of Pythonscript, about half of which is a string of Quackery code.
Line 16:
Quackery in a nutshell.
To compile this definition of <code>quackery</code>, <code>build</code> takes a string of Quackscript and turns it into a nest. The left and right brackets delimit a nest, which will contain pointers to the dictionary items called <code>build</code> and <code>do</code>, in that order. Quackery code is evaluated from left to right, one item after another, traversing a tree of nests in depth
The words <code>is</code>, <code>[</code>, and <code>]</code> are builders; they can be found in the builders dictionary, which extends the functionality of <code>build</code> beyond building a flat nest for <code>do</code> to evaluate. <code>is</code> takes the item that <code>do</code> most recently added to its output nest, and adds it to the names dictionary, along with the string that follows it, "<code>quackery</code>" as its name. The syntax of Quackery is; words and numbers are sequences of printable characters, separated by spaces and carriage returns unless a builder treats the text that follows it otherwise. The builder <code>builds</code> is equivalent to <code>is</code> for adding new words and behaviours to the builders dictionary.
Line 22:
Evaluation of a nest proceeds from left to right unless a control flow operator redirects it. <code>done</code> causes <code>do</code>to stop evaluating a nest and return to the nest that pointed to it immediately, rather than at the end of the nest. <code>again</code> restarts the evaluation of that nest, non-recursively. The word <code>recurse</code> does it recursively. <code>if</code> and <code>iff</code> conditionally (depending on the item on the top of the Quackery stack) skip over the next one and two items in the nest respectively. <code>else</code> skips over one item, unconditionally. As with the other provided control flow operators, these words are nests, not operators, that make use of the "meta-control flow" operators, which grant the behaviours described above to words that use them. (They modify items on the return stack, rather than acting on the Quackery engine's various pointers registers directly, so their changes are enacted upon exiting the nest that called them.)
There are no variables in Quackery. Instead, there are stack management words to rearrange the uppermost items on the Quackery stack as required, and nameable ancillary stacks that fulfil the roles of variables.
Everything is code except when it is data. When <code>do</code> does a number, the behaviour of the number is to put its numerical value on the stack. Operators do the heavy lifting; there are operators that treat numbers as integers, or as booleans, or as sequences of bits, or as characters, and there are operators to edit nests, interface with the real-world host computer for I/O, and so on. Nests give structure to code and data alike.
Conceptually, the Quackery engine is a stack based processor which does not have direct access to physical memory
Quackery is not intended to be a super-fast enterprise
If your language supports bignums, first
Or try your hand at one of the [[Tasks not implemented in Quackery]].
|