Re: The semicolon habit (was: Q: Definition

Charles Fiterman <cef@geodesic.com>
Wed, 17 May 1995 13:03:51 GMT

          From comp.compilers

Related articles
[4 earlier articles]
Re: The semicolon habit (was: Q: Definition sys3bga@doc.ntu.ac.uk (1995-05-05)
Re: The semicolon habit (was: Q: Definition stidev@gate.net (1995-05-09)
Re: The semicolon habit (was: Q: Definition plong@perf.com (1995-05-09)
Re: The semicolon habit (was: Q: Definition everettm@walters.East.Sun.COM (1995-05-11)
Re: The semicolon habit (was: Q: Definition schrod@iti.informatik.th-darmstadt.de (1995-05-12)
Re: The semicolon habit (was: Q: Definition anw@maths.nottingham.ac.uk (Dr A. N. Walker) (1995-05-16)
Re: The semicolon habit (was: Q: Definition cef@geodesic.com (Charles Fiterman) (1995-05-17)
Re: The semicolon habit (was: Q: Definition reid@HASKELL.SYSTEMSZ.CS.YALE.EDU (1995-05-16)
Re: The semicolon habit (was: Q: Definition jan@neuroinformatik.ruhr-uni-bochum.de (1995-06-24)
Re: The semicolon habit (was: Q: Definition tim@handel.Princeton.EDU (1995-06-24)
Re: The semicolon habit (was: Q: Definition bevan@cs.man.ac.uk (1995-06-30)
Re: The semicolon habit (was: Q: Definition cbloom@utxvms.cc.utexas.edu (1995-07-01)
Re: The semicolon habit (was: Q: Definition plong@perf.com (Paul Long) (1995-07-05)
[3 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: Charles Fiterman <cef@geodesic.com>
Keywords: syntax, design
Organization: Geodesic Systems
References: 95-05-031 95-05-080
Date: Wed, 17 May 1995 13:03:51 GMT

Mark Everett - Sun Parallel Open Systems <everettm@walters.East.Sun.COM> wrote:
>"Dr A. N. Walker" <anw@maths.nottingham.ac.uk> writes:
>> ludemann@netcom.com (Peter Ludemann) writes about semicolon-free syntaxes:
>> >Indeed: I can think of 3 examples.
>>
>> Here is a fourth: throw away the semicolons in Pascal, and the
>> only ambiguity is that you can't always see where the empty statements are.
>> This can easily be cured by adding a visible representation [such as ";"]
>> of such statements.
>>
>> Whether this is a Good Thing from the point of view of the poor
>> programmer trying to make sense of the error messages coming from the
>> compiler is quite another matter.
>
>I was always under the impression that garbage characters like ';' were
>there to enable error recovery to provide meaningful error messages. Statement
>delimiters are a place where the compiler can "sync up" with what it is
>expecting. They are not needed in correct programs, but rather incorrect
>ones.
>
If thats their purpose they serve negative value. End of line can
do the same thing and the parser can always put the error message
on the correct line.


At one university they scanned a lot of code for continued lines.
This excluded cases where there were () including newlines. It
mearly counted C code where a missing semicolon on one line
caused it to be merged with the next. In about 25% of the cases
the missing semicolon either caused or concealed an error.


Most statements occupy one line, it makes sense to have the
exceptional condition take extra code. In the language we
are building indentation is part of syntax so we need to
say which line is being continued. We use ^^ lined up under
the line being continued.


print
Hello world
I love you
^^ aVariableName
More text


Comes through the lexer the same as
print [Hello world\nI love you\n] aVariableName [More text\n]


We treat indented material as strings. Some users such as 'if' will
cast those strings to code. 'if' will discard its indented argument
unparsed if it evaluates to fail at compile time.
--


Post a followup to this message

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