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:

    The comparison between Coleridge and Johnson is obvious in so far as each held sway chiefly by the power of his tongue. The difference between their methods is so marked that it is tempting, but also unnecessary, to judge one to be inferior to the other. Johnson was robust, combative, and concrete; Coleridge was the opposite. The contrast was perhaps in his mind when he said of Johnson: “his bow-wow manner must have had a good deal to do with the effect produced.”
    Virginia Woolf (1882–1941)

    I suggested to them also the great desirability of a general knowledge on the Island of the English language. They are under an English speaking government and are a part of the territory of an English speaking nation.... While I appreciated the desirability of maintaining their grasp on the Spanish language, the beauty of that language and the richness of its literature, that as a practical matter for them it was quite necessary to have a good comprehension of English.
    Calvin Coolidge (1872–1933)