mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
scrapping earlier impl of func SEQ
This commit is contained in:
@@ -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."
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user