by Greg Tourville
Simple scripting language based on the idea of duck-typing

The duck programming language supports first-class functions, integer and floating-point arithmetic, string manipulation, dynamically-sized arrays, dictionary types, and basic object oriented programming. The syntax is strongly reminiscent of BASIC, Lua, or Python. While indentation is not strictly specified, the language requires specific whitespace in required newlines at the end of certain statements. Duck is currently only implemented in the form of a slow, interpreted frontend, making it useful as a portable scripting language. This frontend has been developed entirely in C.

function display_primes(limit)
    count = 0
    numbers = []
    for i = 2 to limit do
        numbers[i] = 1
    loop
    for i = 2 to limit do
        if numbers[i] == 1 then
            count = count + 1
            for j = 2 to limit/i do
                numbers[i*j] = 0
            loop
            duck.print(i)
        end
    loop
end
Information updated 11/15/14
View Comments