BASIC programming language

HomePage | Recent changes | View source | Discuss this page | Page history | Log in |

Printable version | Disclaimers | Privacy policy

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 acromyn for Beginner's All-purpose Symbolic Instruction Code. (c.1). The acronym is not related to C. K. Ogden's series titled "Basic English."(c.1) 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

History

BASIC was at one time the world's most popular programming language, but in it's orginal form is much less popular today. However, the Visual Basic programming language and its close relatives, which have diverged greatly from the original BASIC, are probably the most widely distributed languages in the world today due to their inclusion in every major Microsoft Office application, so BASIC's influence continues to be strong.

Despite its popularity, BASIC has been disdained by most computer professionals from shortly after the development of the first version to present day. The disdain comes from BASIC being a "slow 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.(c.1) 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.(c.1)

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 most 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 its 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. Another free version which includes a GUI builder, is similar to Visual Basic and runs on Windows and Linux is Phoenix Object Basic. The most well known compiled versions are Microsoft's Quick BASIC product line and QBASIC, (a version which does not generate standalone programs.)(c.2) 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 MSWindows.

Examples

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

Dialects


Documents Defining BASIC

ANSI Standard for Minimal BASIC (ANSI X3.60-1978 "FOR MINIMAL BASIC")

ISO Standard for Minimal BASIC (ISO/IEC 6373:1984 "DATA PROCESSING - PROGRAMMING LANGUAGES - MINIMAL BASIC")

ANSI Standard for Full BASIC (ANSI X3.113-1987 "PROGRAMMING LANGUAGES FULL BASIC") $79 USD

ISO Standard for Full BASIC (ISO/IEC 10279:1991 "INFORMATION TECHNOLOGY - PROGRAMMING LANGUAGES - FULL BASIC") $53 USD

ANSI Addendum Defining Modules (X3.113 INTERPRETATIONS-1992 "BASIC TECHNICAL INFORMATION BULLETIN # 1 INTERPRETATIONS OF ANSI 03.113-1987")

ISO Addendum Defining Modules (ISO/IEC 10279:1991/ Amd 1:1994 "MODULES AND SINGLE CHARACTER INPUT ENHANCEMENT")


References

c1. Per correspondence with Thomas E. Kurtz. c2. QBASIC is included on the installation CD-ROM for Windows 95/98/ME.


Originally written for Nupedia. Article by Peter Fedorow fedorowp@yahoo.com