Skip to main content

Basics

ACPUL 1.01

ACPUL programming language

Key features

  • formulas
  • everything is float
  • EOL ; is must

Formula

ACPUL operates formulas.

Formula header defines formula

### my.formula

Multiple formulas example

### my.formula1

rnd(u0);

### my.formula2

sin(x);

Why ;?

; is important! in ACPUL 1.01

0;
a 0;
a b;
a=0;
a+=1;
if (a) {...};
while (a) {...};

Ident

ACPUL defined for any screen size, so 1 ident is prefered

1 ident (default)

2 ident (due to editors)

Name

Define name as number, function or object

a 1;        # a is 1 (number)

fn rnd(u0); # fn is function (expression), returns random number 0..1

fn { # the same
rnd(u0); # returns random number 0..1
};

color { # color is an object with r,g,b values
r 0;
g 0;
b 0;
};

Follow '_'

a {
b 0;
};
a {
_; # follow previous a
c 1;
};
a.b; # 0;
a.c; # 1;
a 0;
b a; # b link to a

Import @file

Import here

_ @sys.node; # use sys.node

Import as object

module @my.module; # module is my.module
module.run;

Variable

The ACPUL programming language has 3 variable declaration operators

Define new variable. Execution independent

a 0; # a is 0

Set new variable

a=0; # 

Update existing variable

b 0; # b is 0
b:=1; # b is 1

Operator if

if (expr) {
...
};

Note:

No else operator in ACPUL 1.01

Operator while

while (expr) {
...
};
i = 0;
while (i < 5) {
i+=1;
};

Note:

Infinitie loops will be break automaticly

Reliability

No recursions

No recursive calls

Maximum call 256 for file import

No more infinitie

Infinitie loops will be break automaticly

No memory overflow

Malcisous formulas will be terminated automaticly