Category:Quackery

This programming language may be used to instruct a computer to perform a task.
See Also: |
|
---|
Quackery is an open-source, lightweight, entry-level concatenative language for educational and recreational programming, and an extensible compiler for a hypothetical processor, the Quackery Engine.
It is coded as a Python 3 function in about 48k of Pythonscript, about half of which is a string of Quackery code.
The Quackery GitHub repository, which includes the Quackery manual "The Book of Quackery" as a pdf, is at github.com/GordonCharlton/Quackery.
About Quackery
The Quackiverse consists of operators (i.e. op-codes or "primitives"), numbers (BigInteger) and nests (dynamic arrays of operators, numbers and nests). They reside on either of two stacks, or in one of the two dictionaries of named items (operators, numbers and nests) that the Quackery compiler, build
, uses to translate written Quackscript into nests that can be evaluated with do
, the default behaviour, or added to either of the dictionaries.
[ build do ] is quackery
Quackery in a nutshell.
To compile this definition of quackery
, build
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 build
and do
, in that order. Quackery code is evaluated from left to right, one item after another, traversing a tree of nests in depth-first order. Once build
has compiled the string, it passes the resultant nest via the Quackery stack, which is used to carry arguments and results from one word to the next, to do
for evaluation. The second stack, the return stack, manages do
's depth-first traversal of nested nests.
The words is
, [
, and ]
are builders; they can be found in the builders dictionary, which extends the functionality of build
beyond building a flat nest for do
to evaluate. is
takes the item that do
most recently added to its output nest, and adds it to the names dictionary, along with the string that follows it, "quackery
" 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 builds
is equivalent to is
for adding new words and behaviours to the builders dictionary.
Evaluation of a nest proceeds from left to right unless a control flow operator redirects it. done
causes do
to stop evaluating a nest and return to the nest that pointed to it immediately, rather than at the end of the nest. again
restarts the evaluation of that nest, non-recursively. The word recurse
does it recursively. if
and iff
conditionally (depending on the item on the top of the Quackery stack) skip over the next one and two items in the nest respectively. else
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 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 do
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 but has a memory management co-processor that intermediates, that takes care of the nests and bignums, provides pointers to the Quackery engine CPU on request, and garbage collects continuously.
Quackery is not intended to be a super-fast enterprise-level language; it is intended as an exploration of a novel architecture, and a fun programming project straight out of a textbook. (The textbook is included in the download.)
Why not try your hand at one of the Tasks not implemented in Quackery.
Pages in category "Quackery"
The following 200 pages are in this category, out of 750 total.
(previous page) (next page)F
- Find minimum number of coins that make a given value
- Find prime n such that reversed n is also prime
- Find prime numbers of the form n*n*n+2
- Find square difference
- Find squares n where n+1 is prime
- Find the last Sunday of each month
- Find the missing permutation
- Find words which contain all the vowels
- Find words which contains more than 3 e vowels
- Find words whose first and last three letters are equal
- Find words with alternating vowels and consonants
- First 9 prime Fibonacci number
- First perfect square in base n with n unique digits
- First-class functions
- First-class functions/Use numbers analogously
- Five weekends
- FizzBuzz
- Flatten a list
- Flipping bits game
- Flow-control structures
- Floyd's triangle
- Forbidden numbers
- Formatted numeric output
- Forward difference
- Four bit adder
- Four sides of square
- Fractal tree
- Fractran
- Frobenius numbers
- Function composition
- Function definition
- Function prototype
- Fusc sequence
G
- Gapful numbers
- Gaussian primes
- General FizzBuzz
- Generate lower case ASCII alphabet
- Generate random numbers without repeating a value
- Generator/Exponential
- Generic swap
- Get system command output
- Getting the number of decimal places
- Giuga numbers
- Golden ratio/Convergence
- Gotchas
- Gray code
- Greatest common divisor
- Greatest element of a list
- Greatest subsequential sum
- Greyscale bars/Display
- Guess the number
- Guess the number/With feedback
- Guess the number/With feedback (player)
H
- Hailstone sequence
- Halt and catch fire
- Hamming numbers
- Happy numbers
- Harmonic series
- Harshad or Niven series
- Hello world/Graphical
- Hello world/Newbie
- Hello world/Newline omission
- Hello world/Text
- Hex words
- Higher-order functions
- Hilbert curve
- History variables
- Hofstadter Figure-Figure sequences
- Hofstadter Q sequence
- Hofstadter-Conway $10,000 sequence
- Holidays related to Easter
- Honaker primes
- Huffman coding
- Humble numbers
- Hunt the Wumpus
I
- Iccanobif primes
- Identity matrix
- Idiomatically determine all the characters that can be used for symbols
- Idiomatically determine all the lowercase and uppercase letters
- Include a file
- Increment a numerical string
- Index finite lists of positive integers
- Input/Output for lines of text
- Input/Output for pairs of numbers
- Integer comparison
- Integer overflow
- Integer roots
- Integer sequence
- Interactive programming (repl)
- Intersecting number wheels
- Inventory sequence
- Inverted syntax
- ISBN13 check digit
- Isograms and heterograms
- Isqrt (integer square root) of X
- Iterated digits squaring
J
L
- L-system
- Lah numbers
- Langton's ant
- Largest difference between adjacent primes
- Largest five adjacent number
- Largest int from concatenated ints
- Largest number divisible by its digits
- Largest palindrome product
- Largest prime factor
- Largest product in a grid
- Largest proper divisor of n
- Last Friday of each month
- Last list item
- Law of cosines - triples
- Leap year
- Least common multiple
- Least m such that n! + m is prime
- Left factorials
- Leonardo numbers
- Letter frequency
- Linear congruential generator
- Literals/Floating point
- Literals/Integer
- Literals/String
- Logical operations
- Long literals, with continuations
- Long multiplication
- Long primes
- Long stairs
- Long year
- Longest common prefix
- Longest common substring
- Longest common suffix
- Longest string challenge
- Look-and-say sequence
- Loop over multiple arrays simultaneously
- Loops/Break
- Loops/Continue
- Loops/Do-while
- Loops/Downward for
- Loops/For
- Loops/For with a specified step
- Loops/Foreach
- Loops/Increment loop index within loop body
- Loops/Infinite
- Loops/N plus one half
- Loops/Nested
- Loops/While
- Lucas-Lehmer test
- Ludic numbers
- Luhn test of credit card numbers
M
- Machine code
- Magic 8-ball
- Magic constant
- Magnanimous numbers
- Map range
- Matrix transposition
- Matrix with two diagonals
- Maximum triangle path sum
- McNuggets problem
- Menu
- Mersenne primes
- Mertens function
- Metallic ratios
- Metaprogramming
- Mian-Chowla sequence
- Middle three digits
- Miller–Rabin primality test
- Mind boggling card trick
- Minimum multiple of m where digital sum equals m
- Minimum numbers of three lists
- Minimum primes
- Modular arithmetic
- Modular exponentiation
- Modular inverse
- Monte Carlo methods
- Montgomery reduction
- Monty Hall problem
- Morse code
- Mosaic matrix
- Motzkin numbers
- Move-to-front algorithm
- Multi-dimensional array
- Multifactorial
- Multiplication tables
- Munchausen numbers
- Mutual recursion
- Möbius function