scrapping earlier impl of func SEQ

This commit is contained in:
minjaesong
2020-11-28 23:05:05 +09:00
parent baa47ae473
commit d9d256fcca
2 changed files with 5 additions and 6 deletions

View File

@@ -1,9 +1,7 @@
1 FOR I = 99 TO 1
2 (MODE = 1)
3 (GOSUB 12)
2 (MODE = 1):(GOSUB 12)
4 PRINT(I+" bottle"+BOTTLES$+" of beer on the wall, "+i+" bottle"+BOTTLES$+" of beer.")
5 (MODE = 2)
6 (GOSUB 12)
5 (MODE = 2):(GOSUB 12)
7 PRINT("Take one down and pass it around, "+(i-1)+" bottle"+BOTTLES$+" of beer on the wall.")
8 NEXT
9 PRINT "No more bottles of beer on the wall, no more bottles of beer."

View File

@@ -422,7 +422,7 @@ if no arg text were given (e.g. "10 NEXT"), args will have zero length
});
},
":" : function(lnum, args) { // functional sequence
// just do nothing
// TODO alternative method of impl: make syntax tree to have two or more consequent command "roots" and execute from there
},
"+" : function(lnum, args) { // addition, string concat
return twoArg(lnum, args, function(lh, rh) { return lh + rh; });
@@ -532,13 +532,14 @@ if no arg text were given (e.g. "10 NEXT"), args will have zero length
return oneArgNum(lnum, args, function(lh) {
if (lh < 0) throw lang.syntaxfehler(lnum, lh);
bStatus.gosubStack.push(lnum + 1);
println(lnum+" GOSUB into "+lh);
return lh;
});
},
"RETURN" : function(lnum, args) {
var r = bStatus.gosubStack.pop();
if (r === undefined) throw lang.nowhereToReturn(lnum);
serial.println(lnum+" RETURN to "+r);
println(lnum+" RETURN to "+r);
return r;
},
"CLEAR" : function(lnum, args) {