- Express BASIC - a Tiny BASIC interpreter in C
- 17 Oct 2023 12:56:33 pm
- Last edited by lucidapogee on 04 Mar 2024 06:01:52 pm; edited 1 time in total

Express BASIC is a minimal BASIC dialect that is suitable for performing complex calculations. The language is inspired by Dartmouth, Palo Alto, Altair, GW BASIC, and the many dialects of Tiny BASIC. The interpreter is written in C and is open source.

The goal of this language is to develop and maintain a syntax that is more standard than Craft Basic or Commando Basic. Programs may be copy/pasted into GW BASIC with little to no modification. The syntax of Express BASIC and Net Basic are intended to be similar. This allows you to write code that works locally and on the net.

Available for all versions of Windows 95 and up. It's a Windows console program, so it will work on 10 and 11.

Get it here: https://lucidapogee.com/index.php?page=expressbasic

Here's a few examples...

**Code:**

```
10 REM ROCKET.BAS by Brian Tung
```

20 REM Modified to work with Express Basic

30 LET a = 1.032

40 LET d = 1

50 PRINT "Earth gravity in light-years per year squared: "; a

55 PRINT "Distance in light-years (0-100 million): "; d

60 IF d >= 0 AND d <= 100000000 THEN 80

70 PRINT "Distance must be between 0 and 100 million l-y"

75 END

80 LET d1 = d / 2

90 LET t = SQR(d1 * d1 + (2 * d1 / a))

100 LET x = a * t

110 LET m = 1

120 IF x >= 0 THEN 130

125 LET m = -1

130 LET s = LOG(ABS(x) + 1)

140 LET s1 = s + 1

150 LET x1 = (EXP(s) - EXP(s * -1)) / 2 - ABS(x)

160 LET s1 = x1 / (EXP(s) + EXP(s * -1)) / 2

170 LET s = s - s1

180 IF ABS(s1) > .0000001 THEN 150

190 LET t1 = 1 / a * s * m

200 LET v = a * t / SQR(1 + (a * t) * (a * t))

210 PRINT "Time on Earth: "; 2 * t; " years"

220 PRINT "Time on board: "; 2 * t1; " years"

230 SHELL "pause"

**Code:**

```
1 REM MODIFIED TO WORK WITH EXPRESS BASIC
```

10 PRINT "HURKLE"

20 PRINT "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"

30 PRINT

110 LET N=5

120 LET G=10

210 PRINT

220 PRINT "A HURKLE IS HIDING ON A ";G;" BY ";G;" GRID. HOMEBASE"

230 PRINT "ON THE GRID IS POINT 0,0 IN THE SOUTHWEST CORNER,"

235 PRINT "AND ANY POINT ON THE GRID IS DESIGNATED BY A"

240 PRINT "PAIR OF WHOLE NUMBERS. THE FIRST NUMBER IS"

245 PRINT "THE HORIZONTAL POSITION AND THE SECOND NUMBER"

246 PRINT "IS THE VERTICAL POSITION. YOU MUST TRY TO"

250 PRINT "GUESS THE HURKLE'S GRIDPOINT. YOU GET ";N;" TRIES."

260 PRINT "AFTER EACH TRY, I WILL TELL YOU THE APPROXIMATE"

270 PRINT "DIRECTION TO GO TO LOOK FOR THE HURKLE."

280 PRINT

285 LET A=INT(G*RND)

286 LET B=INT(G*RND)

290 LET K = 0

310 LET K = K + 1

320 PRINT "GUESS #";K

330 INPUT "X: ", X

335 INPUT "Y: ", Y

340 IF ABS(X-A)+ABS(Y-B)=0 THEN 500

350 REM PRINT INFO

360 GOSUB 610

370 PRINT

380 IF K <= N THEN 310

410 PRINT

420 PRINT "SORRY, THAT'S ";N;" GUESSES."

430 PRINT "THE HURKLE IS AT ";A;",";B

440 PRINT

450 PRINT "LET'S PLAY AGAIN, HURKLE IS HIDING."

460 PRINT

470 GOTO 285

500 REM

510 PRINT

520 PRINT "YOU FOUND HIM IN ";K;" GUESSES!"

540 GOTO 440

610 PRINT "GO ";

620 IF Y=B THEN 670

630 IF Y<B THEN 660

640 PRINT "SOUTH";

650 GOTO 670

660 PRINT "NORTH";

670 IF X=A THEN 720

680 IF X<A THEN 710

690 PRINT "WEST";

700 GOTO 720

710 PRINT "EAST";

720 PRINT

730 RETURN

999 END

**Code:**

```
1 REM https://rosettacode.org/wiki/Attractive_numbers
```

10 FOR x = 1 TO 120

20 LET n = x

30 LET c = 0

40 IF n MOD 2 <> 0 THEN 70

50 LET n = INT(n / 2)

60 LET c = c + 1

70 IF n MOD 2 = 0 THEN 40

80 FOR i = 3 TO SQR(n) STEP 2

90 IF n MOD i <> 0 THEN 120

100 LET n = INT(n / i)

110 LET c = c + 1

120 IF n MOD i = 0 THEN 90

130 NEXT i

140 IF n <= 2 THEN 160

150 LET c = c + 1

160 IF NOT(PRIME(c)) THEN 180

170 PRINT x,

180 NEXT x

190 PRINT

200 SHELL "pause"

**Code:**

```
1 REM https://rosettacode.org/wiki/Nth_root
```

5 PRECISION 6

10 LET a = INT(RND * 5999) + 2

20 PRINT "nth root of "; a; "..."

30 FOR n = 1 TO 10

40 LET p = .00001

50 LET x = a

60 LET y = a / n

70 IF ABS(x - y) <= p THEN 110

80 LET x = y

90 LET y = ((n - 1) * y + a / y ^ (n - 1)) / n

100 IF ABS(x - y) > p THEN 80

110 PRINT n; " : "; y

120 NEXT n

130 SHELL "pause"