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:

    Acknowledge your will and speak to us all, “This alone is what I will to be!” Hang your own penal code up above you: we want to be its enforcers!
    Friedrich Nietzsche (1844–1900)

    ... the self respect of individuals ought to make them demand of their leaders conformity with an agreed-upon code of ethics and moral conduct.
    Mary Barnett Gilson (1877–?)