Reserved Word - Comparison By Language

Comparison By Language

Not all languages have the same numbers of reserved words. For example, Java (and other C derivatives) has a rather sparse complement of reserved words—approximately 50 – whereas COBOL has approximately 400. At the other end of the spectrum, pure Prolog has none at all.

The number of reserved words in a language has little to do with how “powerful” a language is. COBOL was designed in the 1950s as a business language and was made to be self-documenting using English-like structural elements such as verbs, clauses, sentences, sections and divisions. C, on the other hand, was written to be very terse (syntactically) and to get more text on the screen. For example, compare the equivalent blocks of code from C and COBOL to calculate weekly earnings:

// Calculation in C: if (salaried) amount = 40 * payrate; else amount = hours * payrate; * Calculation in COBOL: IF Salaried THEN MULTIPLY Payrate BY 40 GIVING Amount ELSE MULTIPLY Payrate BY Hours GIVING Amount END-IF. * Other example of calculation in COBOL: IF Salaried COMPUTE Amount = Payrate * 40 ELSE COMPUTE Amount = hours * payrate END-IF.

Pure Prolog logic is expressed in terms of relations, and execution is triggered by running queries over these relations. Constructs such as loops are implemented using recursive relationships.

All three of these languages can solve the same types of “problems” even though they have differing numbers of reserved words. This “power” relates to their belonging to the set of Turing-complete languages.

Read more about this topic:  Reserved Word

Famous quotes containing the words comparison and/or language:

    We teach boys to be such men as we are. We do not teach them to aspire to be all they can. We do not give them a training as if we believed in their noble nature. We scarce educate their bodies. We do not train the eye and the hand. We exercise their understandings to the apprehension and comparison of some facts, to a skill in numbers, in words; we aim to make accountants, attorneys, engineers; but not to make able, earnest, great- hearted men.
    Ralph Waldo Emerson (1803–1882)

    The necessity of poetry has to be stated over and over, but only to those who have reason to fear its power, or those who still believe that language is “only words” and that an old language is good enough for our descriptions of the world we are trying to transform.
    Adrienne Rich (b. 1929)