Exercise 37. Little BASIC
You are now going to take a trip back in time to my childhood and implement a BASIC interpreter. No, I don’t mean BASIC as in “a really simple bland interpreter.” I mean the programming language BASIC. It was one of the very first programming languages, originally created at Dartmouth by John Kemeny and Thomas Kurtz. This version of basic is called Dartmouth BASIC, and the code looked something like this from the Dartmouth BASIC Wikipedia page (https://en.wikipedia.org/wiki/Dartmouth_BASIC):
5 LET S = 0 10 MAT INPUT V 20 LET N = NUM 30 IF N = 0 THEN 99 40 FOR I = 1 TO N 45 LET S = S + V(I) 50 NEXT I 60 PRINT S/N 70 GO TO 5 99 END
Those numbers to the left are actually manually entered line numbers. You told BASIC a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access