Semicolon in Eiffel

knishimo@cat.cce.usp.br (Kazuo Nishimoto)
Mon, 8 May 1995 11:41:39 GMT

          From comp.compilers

Related articles
Semicolon in Eiffel knishimo@cat.cce.usp.br (1995-05-08)
| List of all articles for this month |

Newsgroups: comp.compilers
From: knishimo@cat.cce.usp.br (Kazuo Nishimoto)
Keywords: syntax, Eiffel, design
Organization: Compilers Central
Date: Mon, 8 May 1995 11:41:39 GMT

Most of the discussion about semicolon is centered in the languages C or
C++. I think the Eiffel approach to this is very interesting. Below is a
transcript of a section about syntax and the semicolon in the book
"Eiffel: The Language" by Bertand Meyer.


-------------------------------------------------------------------------------


For syntax, some pragmatism does not hurt. A modern version of the
struggle between big-endians and little-endians provides a good example.
The programming language world is unevenly divided between partisans of
the semicolon (or equivalent) as terminator and the Algol camp of
semicolon-as-delimiter. Although the accepted wisdom nowadays is heavily
in favor of the first approach, I belong to the second school. But in
practice what matters is not anyone's taste but convenience for software
developers: adding or forgetting a semicolon should not result in any
unpleasant consequences.


In th syntax of Eiffel, the semicolon is theoretically a delimiter
(between instructions, declarations, Index_term clauses, Parent parts);
but the syntax was so designed as to make the semicolon syntatically
redundant, useful only to improve readability; so in most contexts it is
optional.


This tolerance is made possible by two syntatical properties: an empty
construct is always legal; and the use of proper construct terminators
(often end) ensures that no new component of a text may be mistaken for
the continuation of the previous construct. For example in


x := y (The recommended style suggests
a := b including a semicolon after y.)


no construct may involve two adjacent identifiers, so that 'a' after 'y'
must begin a new instruction, even without a semicolon.


-------------------------------------------------------------------------------


Eduardo Issao Ito (knishimo@cat.cce.usp.br)
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.