A little language problem

Computer-speak is not human-speak

Trying to state clearly and explicitly in English what actions must be performed to draw a letter 'g', or trying to spell out exactly to another English speaker the general procedures involved in pluralising English words, these are, as we suggested earlier, difficult enough tasks in themselves. But, if you intend to give your instructions to a computer, there is another serious problem.You have anticipated, of course, that computers don't speak English and that in order to communicate, you are going to need to learn a foreign language. But if, as seems sensible, you set out to learn the computer's own native language, you soon find that the task is quite daunting. The problem is that native computer languages are quite unlike human languages and are therefore especially difficult for humans to handle. They typically work with an alphabet of only two letters and provide for a vocabulary of only a couple of hundred words. Saying what you want done can be an extremely long-winded and painful business.

Finding a go-between

The good news -first - is that there is a partial way around this difficulty. It is usually possible to find an interpreter who (or which) knows both the machine's language and some other language which we can learn instead. The bad news is that this other language will not be a human language either. But take heart. At least it will be a language more like your own and will be learnable with much less pain. An intermediate language of this sort, is usually referred to as a high-level programming language.

In a high-level language, a wide range of standard general-purpose instructions, which would be difficult or tedious to spell out to the computer directly, are handled by simple new expressions which can be automatically translated into the corresponding machine language forms. In a reasonably high-level language you can typically say something like

print "john

instead of

print 'j' at current cursor position, move the cursor right one position, print 'o', move cursor right one. . . print carriage-return.

And if you think that that is painful, it is already vastly simpler than setting out the instructions in the machine's own tongue.

Interpreters and compilers

The translation of a high-level programming language into machine code is performed either by an intepreter or a compiler. An interpreter is a piece of software which translates the high-level language instruction by instruction so that the computer can carry out what is required at each and every step. Interpreters operate, in other words, like human interpreters at international conferences or signers (for the deaf) who provide simultaneous translation. A compiler is a piece of software which translates at one sitting an entire set of instructions in order to provide a parallel machine code version which may then be submitted to the computer, after the event, as a complete program. This is like the translator of a book who supplies the publisher, and reader, with the translation only when the whole text is complete.

Many programming languages have available either an interpreter or a compiler - but not both - and it is common as a result to talk of an interpreted language or a compiled language. Rather fewer languages offer both types of translation.

Inevitably, each system has advantages and disadvantages. For example, because instructions in an interpreted language are responded to immediately, a program can generally be tried out and tested more conveniently. But imagine what happens when an interpreted program contains a loop (i.e. a series of instructions to be run through repeatedly). Each time the loop is passed through, every instruction in that loop is translated, again and again and ... With a compiled language on the other hand these same instructions are compiled in advance once and for all and the loop is looped through directly in machine code without interruption. An interpretive language thus allows for interactive programming but is usually slow to run; a compiled language is tedious to write and test but is much faster in operation.



Ron Brasington
Department of Linguistic Science
The University of Reading
Reading
UK

E-mail: ron.brasington@rdg.ac.uk