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.
12 lines
187 B
QBasic
12 lines
187 B
QBasic
10 REM ON GOTO/GOSUB test
|
|
20 FOR I = 1 TO 3
|
|
30 ON I GOTO 100, 200, 300
|
|
40 NEXT I
|
|
50 END
|
|
100 PRINT "Branch 1"
|
|
110 GOTO 40
|
|
200 PRINT "Branch 2"
|
|
210 GOTO 40
|
|
300 PRINT "Branch 3"
|
|
310 GOTO 40
|