Extensible Embeddable Language - Example Code

Example Code

The classic hello world program can be written as follows:

export function main { print("Hello, world!\n"); return 0; }

The following is an example of a recursive function:

export function main { print("Recursion test 1:\n"); procedure recurse(arg) { print("arg = ", arg, "\n"); if arg recurse(arg - 1); } recurse(10); print("Recursion test 2; Mutual Recursion:\n"); procedure mrecurse2(arg); procedure mrecurse1(arg) { print("arg = ", arg, "\n"); if arg mrecurse2(arg); } procedure mrecurse2(arg) { mrecurse1(arg - 1); }; mrecurse1(10); print("Recursion test 2; Mutual Recursion with Function Reference:\n"); procedure mrrecurse1(arg, fn) { print("arg = ", arg, "\n"); if arg fn(arg, fn); } local mrr2 = procedure (arg, fn) { mrrecurse1(arg - 1, fn); }; mrrecurse1(10, mrr2); print(Recursion tests done.\n); return 0; }

Read more about this topic:  Extensible Embeddable Language

Famous quotes containing the word code:

    ...I had grown up in a world that was dominated by immature age. Not by vigorous immaturity, but by immaturity that was old and tired and prudent, that loved ritual and rubric, and was utterly wanting in curiosity about the new and the strange. Its era has passed away, and the world it made has crumbled around us. Its finest creation, a code of manners, has been ridiculed and discarded.
    Ellen Glasgow (1873–1945)