|Q: Definition of a scripting lang. firstname.lastname@example.org (1995-03-04)|
|Re: Q: Definition of a scripting lang. email@example.com (1995-03-10)|
|Re: Q: Definition of a scripting lang. firstname.lastname@example.org (1995-03-15)|
|Re: Q: Definition of a scripting lang. email@example.com (1995-03-27)|
|Re: Q: Definition of a scripting lang. firstname.lastname@example.org (1995-04-05)|
|Re: Q: Definition of a scripting lang. email@example.com (1995-04-16)|
|Re: Q: Definition of a scripting lang. firstname.lastname@example.org (1995-04-18)|
|Keywords:||interpreter, design, comment|
|Organization:||Rutgers University Department of Computer Science|
|Date:||Tue, 18 Apr 1995 19:07:40 GMT|
Larry Wall argues that explicit line terminators are "natural" in programming
languages because, after all, we use them in English (and other natural
Let's continue his argument. In every natural language I know of, case
distinctions have no non-redundant semantic content. In fact, in English the
rules for capitalization are pretty much fixed, and if I write a sentence
in all lower-case, you generally would have no problem determining what to
capitalize. (There may be a few exceptional cases like acronyms, but they
are quite rare.) The particular rules in other Western languages vary, but
the same remains true: Capitalization may help you visually parse a sentence,
but you'll have to trouble reading it in all caps, all lower-case, or in punky
random mixed case.
Nevertheless, most programming languages today *do* maintain case distinc-
tions. This argues strongly that identifying programming languages with
natural languages misses the point, at least to some degree. Just because
we use grammatical techniques original developed by linguists studying natural
languages doesn't mean programming languages are very much like natural
languages! For another example, programming languages make a good deal of
recursion, while natural language structures tend, in general, to be quite
simple and of highly bounded depth. It's easy to find natural examples of
code whose parse tree is 10 or 15 levels deep, but rather hard to construct
a *natural* natural-language example of such a thing!
Much of what's in programming languages, I contend, stems from a different
source entirely: Mathematical formulas. Mathematical formulas *do* assign
semantic meaning to letter case. They *do* have rather deep recursive
structures, in exactly the same way (and for the same reasons) as expres-
sions in programming languages. In fact, the expressions in almost all
programming languages are pretty much direct cribs from traditional mathema-
tical syntax. In many cases, the real semantic content of a program is in
the expressions. The non-expression statements form an overall structure
within which those expressions must fit. In this way, many programs are like
math texts: English sentences and sentence fragments form a scaffolding
within which the "real stuff" - the formulas - are embedded.
Finally - coming back to the original point: Mathematical formulas are almost
always written with no explicit "end of formula" markers. Whitespace and
line breaks are generally enough to provide an unambiguous interpretation.
In "heavy" math, even the interpolated English text consists mainly of
sentence fragments with minimal punctuation.
I'll bet almost all missing semicolons are missing at the end of expression
statements, not at the end of other kinds of statements. Partly this is an
artifact of language design - non-expression statements are often self-termi-
nating and don't need a semicolon. But partly I suspect it's because even
experienced programmers think of expressions as "like" mathematical formulas,
and they apply the "natural laws" of that domain.
[Natural language tends to have simple syntax. Hmmn. The theory
that the message that Jerry wrote expounds confuses me. -John]
Return to the
Search the comp.compilers archives again.