Jump to content

BASIC

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Clasqm (talk | contribs) at 18:34, 28 September 2001. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

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
  1. Be a general-purpose language
  1. Allow advanced features to be added for experts (while keeping the language simple for beginners)
  1. Be interactive
  1. Provide clear and friendly error messages
  1. Respond fast for small programs
  1. Not require an understanding of computer hardware
  1. Shield the user from the operating system



BASIC is the worlds 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 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 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 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. 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.



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


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