Or Basic compiler/system in Fortran IV
I came across fosbic1 on github by accident, so intrigued by the description:
This is the FOSBIC1 compiler developed at the University of Gießen, Germany in the late 70s for the CDC 3300 batch system. It is a BASIC compiler and runtime system which is written in FORTRAN IV. The text book from which the source code was copied implies that it is a modified version of a BASIC compiler named UWBIC from the University of Washington, developed by William Sharp in 1967, for their IBM 7094.
So, without going into it much further I went ahead and made a few minor changes to get it running on Microsoft Fortran
Instead of some boring example, I thought I’d try some Mandelbrot, so going through this collection on rosettacode, I thought the OS/8 version looked simple enough to work with.
Sadly it doesn’t seem to be very ASCII so it doesn’t understand numerical characters. Maybe I’m doing it wrong I didn’t see anything. Just as my attempt to set a string variable to itself + a new letter then print that string strangely failed. Also it does weird stuff with strings, again it maybe me, but I’m impatient. This is terrible, and yeah I know.
TESTCOMPILER -- BASIC BWL 5 GIESSEN -- VERSION 6/76-04
10 X1=59
11 Y1=21
20 I1=-1.0
21 I2=1.0
22 R1=-2.0
23 R2=1.0
30 S1=(R2-R1)/X1
31 S2=(I2-I1)/Y1
40 FOR Y=0 TO Y1
50 I3=I1+S2*Y
60 FOR X=0 TO X1
70 R3=R1+S1*X
71 Z1=R3
72 Z2=I3
80 FOR N=0 TO 30
90 A=Z1*Z1
91 B=Z2*Z2
100 IF A+B>4.0 GOTO 130
110 Z2=2*Z1*Z2+I3
111 Z1=A-B+R3
120 NEXT N
130 REM PRINT CHR$(0062-N);
131 IF N=0 THEN 200
132 IF N=1 THEN 202
133 IF N=10 THEN 204
134 IF N=11 THEN 206
135 IF N=12 THEN 208
136 IF N=14 THEN 210
137 IF N=15 THEN 212
138 IF N=16 THEN 214
139 IF N=17 THEN 216
140 IF N=19 THEN 218
141 IF N=2 THEN 230
142 IF N=20 THEN 232
143 IF N=22 THEN 234
144 IF N=23 THEN 236
145 IF N=24 THEN 238
146 IF N=25 THEN 240
147 IF N=3 THEN 242
148 IF N=30 THEN 244
149 IF N=31 THEN 246
150 IF N=4 THEN 248
151 IF N=5 THEN 250
152 IF N=6 THEN 252
153 IF N=7 THEN 254
154 IF N=8 THEN 256
155 IF N=9 THEN 258
200 PRINT 'A';
201 GOTO 439
202 PRINT 'B';
203 GOTO 439
204 PRINT 'C';
205 GOTO 439
206 PRINT 'D';
207 GOTO 439
208 PRINT 'E';
209 GOTO 439
210 PRINT 'F';
211 GOTO 439
212 PRINT 'G';
213 GOTO 439
214 PRINT 'H';
215 GOTO 439
216 PRINT 'I';
217 GOTO 439
218 PRINT 'J';
219 GOTO 439
230 PRINT 'K';
231 GOTO 439
232 PRINT 'L';
233 GOTO 439
234 PRINT 'M';
235 GOTO 439
236 PRINT 'N';
237 GOTO 439
238 PRINT 'O';
239 GOTO 439
240 PRINT 'P';
241 GOTO 439
242 PRINT 'Q';
243 GOTO 439
244 PRINT 'R';
245 GOTO 439
246 PRINT '-';
247 GOTO 439
248 PRINT 'T';
249 GOTO 439
250 PRINT 'U';
251 GOTO 439
252 PRINT 'V';
253 GOTO 439
254 PRINT 'W';
255 GOTO 439
256 PRINT 'X';
257 GOTO 439
258 PRINT 'Y';
259 GOTO 439
439 REM
440 NEXT X
450 PRINT '-EOL'
460 NEXT Y
461 PRINT 'END'
470 END
It runs in batches, so it’s not interactive. Very mainframe/1960’s minicomputer like. I guess it’s fitting again being in FORTRAN.
******************* EVERYTHING SEEMS OK -- LET'S GO AHEAD
PERCENT OF AVAILABLE STORAGE USED 31.081
PERCENT OF AVAILABLE DATA STORAGE USED .000
PERCENT OF AVAILABLE NUMBERED STATEMENTS USED 30.294
AA A A A A B B B B B K K K K K
K K K K K K K K K K Q Q Q Q Q
Q T T T U X F D E T Q Q Q Q K
K K K B B B B B B B B B B B -EOL
I’m not sure what is up with the AA and after that, it’s all tabulated. I ended up running it through sed to remove the spaces, and using notepad to stitch the lines together. I guess I could have bash’d it some more but.. I’m impatient.
So yeah, it looks like it worked! Very amazing. And of course it’s crazy fast but that should be expected I suppose. I don’t like the hard coded table, but I just wanted to get it to generate an image.
Sadly, the author of the compiler, Weber seems to have disappeared, and the publisher Paul Haupt died in 1978, a year after this being published.