ARIBAS

Implementation of programming language ARIBAS

Standard implementation of ARIBAS, written in C.

Examples:

Factorial:

Example for versions ARIBAS 1.53

This example uses built-in factorial function.

ARIBAS uses integer type for variables by default, so type declaration can be omitted.

group(0) is used to cancel digit groups separation by underscores during output.

function fac0_16();
var n;
begin
    for n := 0 to 16 do
        writeln(n, "! = ", factorial(n): group(0));
    end;
end;

fac0_16().

Factorial:

Example for versions ARIBAS 1.53

This example uses recursive factorial definition.

Function name fac is used because factorial is reserved function name in ARIBAS.

ARIBAS uses integer type for variables by default, so type declaration can be omitted.

group(0) is used to cancel digit groups separation by underscores during output.

function fac(n);
begin
    if (n = 0) then
        return(1);
    end;
    return(n * fac(n - 1));
end;

function fac0_16();
var n;
begin
    for n := 0 to 16 do
        writeln(n, "! = ", fac(n): group(0));
    end;
end;

fac0_16().

Hello, World!:

Example for versions ARIBAS 1.53
writeln("Hello, World!");

Fibonacci numbers:

Example for versions ARIBAS 1.53

This example uses recursive definition of Fibonacci numbers.

ARIBAS uses integer type for variables by default, so type declaration can be omitted.

group(0) is used to cancel digit groups separation by underscores during output.

function fib(n);
begin
    if (n < 3) then
        return(1);
    end;
    return(fib(n-1)+fib(n-2));
end;

function fib1_16();
var n;
begin
    for n := 1 to 16 do
        write(fib(n): group(0), ", ");
    end;
    writeln("...");
end;

fib1_16().