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.
7 lines
124 B
QBasic
7 lines
124 B
QBasic
10 REM Leibniz formula for pi
|
|
20 S = 0
|
|
30 FOR I = 0 TO 999
|
|
40 S = S + (-1)^I / (2*I+1)
|
|
50 NEXT I
|
|
60 PRINT "Pi approx:"; 4*S
|