The Best of Creative Computing Volume 2 (published 1977)

Page 26 << PREVIOUS >> NEXT Jump to page:
Go to contents Go to thumbnails
This book is also available for the Kindle

Beyond BASIC (Putting BASIC in perspective, Compilers, Machine Language)
by Alan B. Salisbury

graphic of page

BEYOND BASIC

by Alan B. Salisbury

INTRODUCTION:

There are many levels of exposure to and interest in computers. It's probably
safe to assume that the majority of Creative Computing's readers are familiar
with BASIC and the computing power which it makes available to them. An equally
safe assumption is that many readers do not have a very deep knowledge of the
computer beyond that which they obtain through BASIC. This level of computer
interest and understanding is sufficient for many purposes and represents a very
large community of computer users.

The vast majority of users of computers have little or no knowledge at all of
the computer. In fact, they may not even be aware at times that they are using a
computer! These "users" include, for instance, the people who drop a quarter
into a slot to play a tennis or hockey-type game using a video screen and hand
controls. Slightly more involved, perhaps, is the person who sits at a terminal
to play STAR TREK after someone else has loaded in the correct program and set
the system up ready for play. Countless other applications could be listed in
which the fact that a computer is doing the behind-the-scenes work may or may
not be apparent to the user.

This article looks in the other direction, beyond BASIC, toward a deeper level
of understanding of the computer. The purpose of twofold: first, it will help
the reader to put
BASIC in its proper perspective in relation to the many other types of computer
software; second, it may (hopefully) stimulate many readers to expand their
knowledge of computers and thus open up whole new areas of excitement and
challenge. 

BASIC IN PERSPECTIVE
  
To begin with, let's review exactly what BASIC really is. Simply stated, BASIC
is a programming "language." Like any language, it has a vocabulary with precise
meanings and a set of rules as to how that vocabulary may be used (semantics and
syntax). BASIC can be used to express problems and their solutions in a form
that is readily understandable by humans – it looks reasonably close to
English and algebra for instance.

Generally, BASIC is not directly understood by computers! (There are a very few
special computers which actually are built to directly understand BASIC,
however.) Hence, a translation is required from a user program written in BASIC
into another form which is directly understandable by the computer. BASIC is
therefore usually referred to as a "higher order language" (HOL) when compared
to a "machine language."

There are other higher order languages, of course, in addition to BASIC. The
most popular of these are FORTRAN (FORmuIa TRANslation), ALGOL (ALGorithmic
Oriented Language) and COBOL (COmmon Business Oriented Language). A host of
additional languages exist, highly tailored to specific uses. All of these
languages are similar in that they require translation into a machine language
before the computer can actually run the program.

COMPILERS

Higher order languages wouldn't be of great value if the programmer was saddled
with the job of doing the translation from BASIC, for instance, to machine
language. Fortunately, this is the type of job that a computer can do very well.
Programs called "compilers" have been written to do this translation for us. A
compiler takes as its "input" a higher order language program (called the
"source program") and produces as its "output" a machine language program
(called the "object" program) ready to be run on the computer. We thus have a
two-step process including a compile (translate) phase and an "execute" (run)
phase.

One of the important and very nice features of higher order languages is that
they are generally "machine independent." That is, when writing in BASIC, the
programmer doesn't need to know if his program will be run on an Interdata 7/16
or a DEC PDP-11/40 for example.' Different translators will, of course, be
required, one for the Interdata machine and one for the DEC machine, since their
machine languages are quite different. These translation programs are usually
provided by the manufacturer of the hardware.

MACHINE LANGUAGE
  
We have mentioned machine language many times without really addressing how it
differs from higher order languages. This can best be understood by looking at
the familiar four-function calculator, which in many ways is a very simple
computer. This calculator can do four functions: add, subtract, multiply and
divide. This is, in effect, the vocabulary of "instructions" which the
calculator understands. We can use the four-function calculator to solve any
problem whose solution can be reduced to a series of steps (a "program") using
the +, -, X, ÷ operations.

As an example, let's consider the BASIC statement:

LET X = A+5

We can translate this into a series of steps (using the calculator) such as the
following:²
      
Clear
Enter A
Depress +
Enter 5
Depress +
Read X

Here we have expanded the vocabulary to include the human actions (clear, enter,
depress for input, and read for output). In the language of the machine/human
team, the above program is a translation of the BASIC statement.

Moving from the four-function calculator to a minicomputer is not difficult. One
major difference is that the

'In fact, some differences in BASIC may occur between manufacturers.

²The exact sequence will depend on the logic of the particular calculator. The
sequence shown is typical.

Page 26 << PREVIOUS >> NEXT Jump to page:
Go to contents Go to thumbnails
This book is also available for the Kindle