Add variable storage (scalar and array), program line storage with RUN/LIST/NEW, and full control flow: FOR/NEXT, GOTO, GOSUB/RETURN, IF/THEN/ELSE, WHILE/WEND, ON GOTO/GOSUB, DATA/READ/RESTORE. New modules: interp.c (1445 lines - execution loop and statement dispatcher), vars.c, arrays.c, input.c. Version bumped to 0.2.0. 16 test programs pass including Leibniz pi and prime sieve.
13 lines
242 B
QBasic
13 lines
242 B
QBasic
10 REM Control flow: GOTO, IF, FOR, GOSUB combined
|
|
20 GOTO 40
|
|
30 PRINT "SKIP THIS"
|
|
40 PRINT "Start"
|
|
50 FOR I = 1 TO 3
|
|
60 IF I = 2 THEN GOSUB 200
|
|
70 PRINT "I ="; I
|
|
80 NEXT I
|
|
90 PRINT "End"
|
|
100 END
|
|
200 PRINT " (subroutine called)";
|
|
210 RETURN
|