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.
16 lines
237 B
QBasic
16 lines
237 B
QBasic
10 REM Array test
|
|
20 DIM A(10), B$(5)
|
|
30 FOR I = 0 TO 10
|
|
40 A(I) = I * I
|
|
50 NEXT I
|
|
60 FOR I = 0 TO 10
|
|
70 PRINT A(I);
|
|
80 NEXT I
|
|
90 PRINT
|
|
100 B$(0) = "Zero"
|
|
110 B$(1) = "One"
|
|
120 B$(2) = "Two"
|
|
130 FOR I = 0 TO 2
|
|
140 PRINT B$(I)
|
|
150 NEXT I
|