Low-Rent Syntax

Stephen D. Clamage <steve@taumet.com>
Sun, 12 Aug 90 20:55:29 GMT

          From comp.compilers

Related articles
Low-Rent Syntax Donald.Lindsay@MATHOM.GANDALF.CS.CMU.EDU (1990-08-09)
Re: Low-Rent Syntax norvell@csri.toronto.edu (Theo Norvell) (1990-08-12)
Re: Low-Rent Syntax doug@nixtdc.UUCP (1990-08-12)
Low-Rent Syntax steve@taumet.com (Stephen D. Clamage) (1990-08-12)
| List of all articles for this month |
Newsgroups: comp.compilers
From: Stephen D. Clamage <steve@taumet.com>
Keywords: parse, design
Organization: Compilers Central
Date: Sun, 12 Aug 90 20:55:29 GMT

There has been some discussion about *how* to design languages which do
not need semicolons to separate or end statements. No one has brought up
why you would want to.


I read a study a while back about 'semicolon' errors made by student
programmers. Two languages were used by different groups, the only
difference was that one used ';' to end statements, and the other used ';'
to separate statements. About the same number of ';' errors were made by
both groups. One could possibly conclude that a language which did not
need ';' at all would be beneficial.


This also calls to mind the story about the professor who got tired of
seeing so many sytax errors in students' programs, as well as in his own.
So he designed a language in which there were no syntax errors -- that is,
every sequence of tokens was legal. Good idea?


Some redundancy is helpful in verifying that a program does what is
intended. That is why modern languages require declarations even in
contexts where default typing could be used (as in FORTRAN and BASIC).
Required declarations protect against misspelling of names as one class of
error, and against misuse of types as another.


One example was given of
a = b
+ c
as being a legal sequence of statements in one language. Almost certainly
this was meant to be a single statement. To avoid bothering the
programmer with piddling semicolon errors, an undetectable semantic error
was allowed to slip through -- one which would be very hard to find.
Would you rather have to go through a single edit/compile cycle to add the
semicolon, or spend days trying to find out why the program doesn't work?


Additionally, the use of possibly-redundant semicolons allows the compiler
to better-isolate errors, and issue better error messages.


Finally, beginning programmers are going to make all kinds of errors, for
all kinds of reasons. For more-experienced programmers, are semicolon
errors a real problem -- as big as other kinds of syntax errors? I'd say
no.


--
Steve Clamage, TauMetric Corp, steve@taumet.com
--


Post a followup to this message

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