Implement basic functions (no parameters yet)
This commit is contained in:
39
IBAF-Tests/IBAF-1/basicControlFlow.fct
Normal file
39
IBAF-Tests/IBAF-1/basicControlFlow.fct
Normal file
@@ -0,0 +1,39 @@
|
||||
initialise-binding scope
|
||||
(collateral
|
||||
(map
|
||||
( ),
|
||||
bind
|
||||
("i",
|
||||
allocate-initialised-variable
|
||||
(integers,
|
||||
0)),
|
||||
map
|
||||
( )),
|
||||
sequential
|
||||
(if-else
|
||||
(true,
|
||||
print true,
|
||||
print false),
|
||||
assign
|
||||
(bound "i",
|
||||
decimal-natural
|
||||
("0")),
|
||||
while
|
||||
(is-less
|
||||
(assigned
|
||||
(bound
|
||||
("i")),
|
||||
decimal-natural
|
||||
("10")),
|
||||
sequential
|
||||
(assign
|
||||
(bound "i",
|
||||
int-add
|
||||
(assigned
|
||||
(bound
|
||||
("i")),
|
||||
decimal-natural
|
||||
("1"))),
|
||||
print assigned
|
||||
(bound
|
||||
("i"))))))
|
||||
13
IBAF-Tests/IBAF-1/basicControlFlow.ibaf
Normal file
13
IBAF-Tests/IBAF-1/basicControlFlow.ibaf
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
if (true) {
|
||||
print(true);
|
||||
}else{print(false);}
|
||||
|
||||
|
||||
|
||||
int i = 0;
|
||||
|
||||
while (i < 10) {
|
||||
i = i+1;
|
||||
print(i);
|
||||
}
|
||||
28
IBAF-Tests/IBAF-1/fun.fct
Normal file
28
IBAF-Tests/IBAF-1/fun.fct
Normal file
@@ -0,0 +1,28 @@
|
||||
initialise-binding scope
|
||||
(collateral
|
||||
(bind
|
||||
("test",
|
||||
function abstraction
|
||||
(scope
|
||||
(collateral
|
||||
(map
|
||||
( )),
|
||||
return decimal-natural
|
||||
("3")))),
|
||||
bind
|
||||
("x",
|
||||
allocate-initialised-variable
|
||||
(integers,
|
||||
0)),
|
||||
map
|
||||
( )),
|
||||
sequential
|
||||
(null,
|
||||
assign
|
||||
(bound "x",
|
||||
handle-return apply
|
||||
(bound "test",
|
||||
null)),
|
||||
print assigned
|
||||
(bound
|
||||
("x"))))
|
||||
9
IBAF-Tests/IBAF-1/fun.ibaf
Normal file
9
IBAF-Tests/IBAF-1/fun.ibaf
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
fun test() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
int x = test();
|
||||
|
||||
print(x);
|
||||
Reference in New Issue
Block a user