TILTraining Set

Software Transformation Systems
Tiny Imperative Language (TIL) Example Programs

Only a couple so far, hopefully many more to come. Possibly we should add a commenting convention to the TIL language to make these more readable.

factors.til

var n;
write "Input n please";
read n;
write "The factors of n are";
var f;
f := 2;
while n != 1 do
    while (n / f) * f = n do
        write f;
        n := n / f;
    end
    f := f + 1;
end

-- JamesCordy - 22 Aug 2005