Re: The semicolon habit (was: Q: Definition of a scripting lang.)

ludemann@netcom.com (Peter Ludemann)
Fri, 28 Apr 1995 19:23:38 GMT

          From comp.compilers

Related articles
Re: Q: Definition of a scripting lang. lwall@netlabs.com (1995-03-27)
The semicolon habit (was: Q: Definition of a scripting lang.) prechelt@i41s25.ira.uka.de (1995-04-11)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) stidev@gate.net (1995-04-19)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) cef@geodesic.com (Charles Fiterman) (1995-04-19)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) ludemann@netcom.com (1995-04-28)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) scooter@mccabe.mccabe.com (1995-04-27)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) cg@Myrias.AB.CA (1995-04-27)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) schrod@iti.informatik.th-darmstadt.de (1995-04-28)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) jgmorris@cs.cmu.edu (Greg Morrisett) (1995-04-29)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) J.C.Highfield@loughborough.ac.uk (1995-04-30)
Re: The semicolon habit (was: Q: Definition of a scripting lang.) mitchell@mdd.comm.mot.com (1995-04-30)
[16 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: ludemann@netcom.com (Peter Ludemann)
Keywords: syntax, design
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: 95-04-013 95-04-107
Date: Fri, 28 Apr 1995 19:23:38 GMT

Lutz Prechelt <prechelt@i41s25.ira.uka.de> wrote:
>rpereda@wotangate.sc.ti.com (Ramon Pereda, ) writes:
>...
>|> Icon has makes an interesting distinction between whitespace and newlines.
>|> Newline automatically inserts a semicolon at the end of a line,
>|> if an "expression" ends on that line and the next line begins with another.
>
>Indeed the semicolons can be a nuisance.
>And it is surprisingly simple (surprising only for us semicolon-grown
>programmers) to create a syntax that needs no semicolons.


Indeed: I can think of 3 examples.


1. BCPL requires a semicolon only if you put multiple
      statements on a line. The end-of-line rule is especially
      elegant: a semicolon is implicitly inserted if it would
      make sense (ie, the semicolon is not inserted if the last
      thing on the line is an operator or if there is an open
      left parenthesis). Given that the designers of C (allegedly
      a BCPL-descendant) didn't like verbosity, I'm surprised that
      they didn't continue this fine tradition [BCPL's style of
      commenting wasn't continued either; but it's now in C++].


2. REXX allows continuing a line by having the last character
      on the line as a comma. This works because comma has no
      intrinsic meaning in REXX (it can be used as an argument
      separator in procedure calls, if you want). I urge all
      scripting language designers to read Cowlishaw's book
      on REXX (my flame to Larry Wall: REXX provides about as much
      "power" as Perl, while having readability sufficiently good
      that IBM managers have been know to program in it; and it works
      well as an underlying language for editors (e.g., as a
      replacement for Emacs-lisp)).


3. The new Arden syntax, where on a challenge I modified the
      grammar to remove all semicolons (now they aren't even needed
      if multiple statements appear on a line). It turned out to be
      surprisingly simple to do ... in most cases, I just changed
      the ";" token to <statement_end>, defined by:
<statement_end> ::= /* empty */
<statement_end> ::= ";"
      If anybody wants to see the grammar, it's in YACC-form in:
ftp.netcom.com:/pub/lu/ludemann/ardenc/ardenc.tar.gz


--
Peter Ludemann ludemann@netcom.com
--


Post a followup to this message

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