enhanced the reader and compiler to treat the binop expression like a message-send expression
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-03 12:18:08 +09:00
parent 4c1a50df83
commit a62b89cea9
18 changed files with 197 additions and 106 deletions

View File

@ -6,7 +6,7 @@ defun aaa(a b) {
set k (aaa 10 20);
if (= k 30) {
if (== k 30) {
printf "OK - %d\n" k;
} else {
printf "ERROR - %d\n" k;
@ -30,7 +30,7 @@ defun mkfun2(t) {
f := (mkfun 20);
set k (f 50);
if (k = 70) {
if (== k 70) {
printf "OK - %d\n" k;
} else {
printf "ERROR - %d\n" k;
@ -39,7 +39,7 @@ if (k = 70) {
k := {
(mkfun 20) 30
}
if (k = 50) {
if (== k 50) {
printf "OK - %d\n" k
} else {
printf "ERROR - %d\n" k
@ -49,14 +49,14 @@ k := {
(mkfun 20) 30 ## the return value of this expression is ignored
(mkfun 20) 40 ## the return value of this expression is the return value of the block expression
}
if (k = 60) {
if (== k 60) {
printf "OK - %d\n" k
} else {
printf "ERROR - %d\n" k
};
k := (((mkfun2 10) 40) 30)
if (k = 80) {
if (== k 80) {
printf "OK - %d\n" k
} else {
printf "ERROR - %d\n" k
@ -64,31 +64,31 @@ if (k = 80) {
## --------------------------------------
## multiple return values
defun f(a :: b c) { b := (a + 10); c := (a + 20) }
defun f(a :: b c) { b := (+ a 10); c := (+ a 20) }
[x, y] := (f 9)
if (x = 19) {
if (== x 19) {
printf "OK - %d\n" x
} else {
printf "ERROR - %d\n" x
}
if (y = 29) {
if (== y 29) {
printf "OK - %d\n" y
} else {
printf "ERROR - %d\n" y
}
## --------------------------------------
k := (defun qq(t) (t + 20))
k := (defun qq(t) (+ t 20))
x := (k 8)
y := (qq 9)
if (x = 28) {
if (== x 28) {
printf "OK - %d\n" x
} else {
printf "ERROR - %d\n" x
}
if (x = 29) {
if (== y 29) {
printf "OK - %d\n" x
} else {
printf "ERROR - %d\n" x
@ -113,7 +113,7 @@ k := (A:newInstance 11 22 33);
##set k (A:newInstance 11 22 33);
set v (k:get-a);
if (= v 11) {
if (== v 11) {
printf "OK - %d\n" v;
} else {
printf "ERROR - %d\n" v;