TXL    up http://www.txl.ca/allabouttxl.html
 
  Description: TXL is a pure functional programming language and rapid prototyping system specifically designed to support source transformation tasks such as computer software analysis and reengineering. The paradigm involves transforming input to output by application of a rooted set of source transformation rules.


 Bubblesort   Jim Cordy
% Bubblesort any sequence of numbers

% Required description of input and output forms - a sequence of numbers
define program
    [repeat number]
end define

% Transform any sequence to a sorted sequence by replacing
% any unordered pair of adjacent numbers by an ordered pair.
% The rule stops when there are no unordered pairs left. 
rule main
    replace [repeat number]
        N1 [number] N2 [number] Rest [repeat number]
    where
        N1 [> N2]
    by
      N2 N1 Rest
end rule
Bubblesort


 Hello World   Jim Cordy
% Required description of input forms - in this case 
% any input will do
define program
    [repeat token]
end define

% Main transformation rule - whatever the input,
% transform it into Hello World
function main
    replace [program]
        _ [program]
    by
        "Hello World"
end function
Prints "Hello World" onto the screen.


 Squares   Jim Cordy
% Transform any number to its square

% Required description of input and output forms - both simply a number
define program
    [number]
end define

% Transform the input number to its square
function main
    replace [program]
        N [number]
    by
      N [* N]
end function
Outputs the square of its input.