BASIC - Programming Language

The BASIC - Programming Language is a high-level programming language invented in 1964 by John George Kemeny and Thomas Eugene Kurtz at Dartmouth College. It was designed to allow students not in science fields to use computers. At the time all computer use required writing custom software, which was something only scientists and mathematicians tended to do. The name is an acronym for Beginners All-purpose Symbolic Instruction Code. The acronym is not related to C. K. Ogdens series titled "Basic English". The acronym is tied to the name of an unpublished paper by Thomas Kurtz.

The eight design principles of BASIC were:


 * 1) Be easy for beginners to use
 * 2) Be a general-purpose language
 * 3) Allow advanced features to be added for experts (while keeping the language simple for beginners)
 * 4) Be interactive
 * 5) Provide clear and friendly error messages
 * 6) Respond fast for small programs
 * 7) Not require an understanding of computer hardware
 * 8) Shield the user from the operating system

BASIC is the world's most popular programming language, despite the disdain for the language by computer professionals from shortly after the development of the first version to present day. The disdain comes from BASIC being an "interpretive unstructured language". Surprisingly the first version of BASIC, Dartmouth BASIC, was not interpretive, and not particularly slow. All later versions of Dartmouth BASIC and the direct descendants have all been compilers.

The first version of BASIC was developed on a timesharing mainframe called the GE-265, which was a GE-235 with a GE DataNet-30. The false reputation for BASIC's slow performance may be tied to the GE FORTRAN compiler for the hardware which placed the startup code at the beginning of the runtime tape, and the shutdown code at the end, resulting in an empty FORTRAN program taking a very long time to run. Dartmouth BASIC has never had this problem.

During the early days of BASIC there were no interpretive versions, however with the advent of the first personal computers multiple interpretive versions of BASIC proliferated. The designers and manufacturers of the first personal computers with keyboards needed to include software to allow people to write software to use on the computers. As all the other programming languages were too large to fit in the small ROM space on the machines, and not even a compiled version of BASIC would fit, interpretive BASIC was chosen. The most widespread versions were made by Microsoft.

Since the early days of the personal computer BASIC compilers, some of them generating code as fast as the fastest versions of Pascal and C, have made a comeback, but despite the addition of structured programming capability it's reputation remains.

BASIC is available for nearly every platform made. One free interpretive version that is compliant with standards and highly cross-platform is ByWater BASIC. The most well known compiled versions are Microsoft's Quick BASIC product line and QBASIC, (a version which does not generate standalone programs). Some versions of the best-selling Visual BASIC product-line are also compiled, although Microsoft has altered Visual BASIC into a language minimally compatible with even early versions of Dartmouth BASIC. Other versions include PowerBASIC's PowerBASIC, as well as True BASIC's True BASIC, a product compliant with the latest official standards for BASIC. (True BASIC Inc. was founded by the original creators of BASIC.) RealBasic is a variant available for the Macintosh which as well generates executables for MS Windows.

Sample 1: Unstructured original BASIC

10 INPUT "What is your name"; A$

20 PRINT "Hello"; A$

30 INPUT "How many stars do you want"; S

40 FOR I = 1 TO S

50 S$ = S$ + "*"

55 NEXT I

60 PRINT S$

70 INPUT "Do you want more stars"; Q$

80 IF LEN(Q$) = 0 GOTO 70

90 L$ = LEFT$(Q$, 1)

100 IF (L$ = "Y") OR (L$ = "y") THEN GOTO 30

110 PRINT "Goodbye";

120 FOR I = 1 TO 200

130 PRINT A$; " ";

140 NEXT I

150 PRINT

Sample 2: Modern Structured BASIC

INPUT "What is your name"; UserName$

PRINT "Hello"; UserName$

DO

INPUT "How many stars do you want"; NumStars

Stars$ = ""

Stars$ = REPEAT$("*", NumStars)	<-ANSI BASIC

Stars$ = STRING(NumStars, "*")	<-MS BASIC

PRINT Stars$

DO

INPUT "Do you want more stars"; Answer$

LOOP UNTIL Answer$ <> ""

LOOP WHILE UCASE$(LEFT$(Answer$, 1)) = "Y"

PRINT "Goodbye";

FOR A = 1 TO 200

PRINT UserName$; " ";

NEXT A

PRINT