Re: language design tradeoffs

nickh@CS.CMU.EDU (Nick Haines)
Thu, 17 Sep 1992 15:48:45 GMT

          From comp.compilers

Related articles
[9 earlier articles]
Re: language design tradeoffs anw@maths.nott.ac.uk (1992-09-16)
Re: language design tradeoffs drw@euclid.mit.edu (1992-09-16)
Re: language design tradeoffs rob@guinness.eng.ohio-state.edu (1992-09-17)
Re: language design tradeoffs bromage@mullauna.cs.mu.OZ.AU (1992-09-17)
Re: language design tradeoffs jch@rdg.dec.com (1992-09-17)
Re: language design tradeoffs firth@sei.cmu.edu (1992-09-17)
Re: language design tradeoffs nickh@CS.CMU.EDU (1992-09-17)
Re: language design tradeoffs norvell@csri.toronto.edu (1992-09-17)
Re: language design tradeoffs jlg@cochiti.lanl.gov (1992-09-17)
Re: language design tradeoffs bks@s27w007.pswfs.gov (1992-09-17)
Re: language design tradeoffs raveling@Unify.com (1992-09-17)
Re: language design tradeoffs jlg@cochiti.lanl.gov (1992-09-18)
Re: language design tradeoffs e86jh@efd.lth.se (1992-09-19)
[19 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers,comp.human-factors
From: nickh@CS.CMU.EDU (Nick Haines)
Organization: School of Computer Science, Carnegie Mellon University
Date: Thu, 17 Sep 1992 15:48:45 GMT
Originator: nickh@VOILA.VENARI.CS.CMU.EDU
Keywords: parse, design
References: 92-09-048 92-09-083

Jim Giles gives us some human-factors rules for statement termination
syntax:


      1) Statements should be distinguishable from one another even *without*
      any terminator or separator. Ie. `x = a+b c = 157.5' is obviously two
      statements because otherwise you have to devise a meaning for two
      consecutive identifiers, allow assignment within expressions, etc..


This is much more difficult in languages with a broader expression syntax.
For instance, if C didn't require parens in function application, that
example could be a single statement, parsed as:


x <- a + (b (c <- 157.5))


Or alternatively if `+' were overloaded suitably, it could be something
like this:


x = a + ((b c) = 157.5)


Many languages (e.g. SML) need statement terminators for this reason. A
sequence of identifiers:


foo bar baz qux quux quuux


could be any number of separate expressions in SML, depending on the
placement of the terminators.


      2) Statements should be explicitly terminated (not separated).


I completely agree with this.


      3) The EOL character should be the statement terminator. For flexibility,
      another statement terminator should be recognized which allows more than
      one statement per line. The semicolon (;) is a good choice for this.


And what about long statements? Surely not the dreaded `continuation marker'?


      4) Comments should also be terminated by the EOL character, so that a
      statement is terminated either by a semicolon, a comment, or a bare EOL.
      And a comment is only to the end of the present line. Comments may
      contain semicolons without them terminating the comment.


I don't like this idea, but don't really know why.


Nick Haines nickh@cmu.edu
--


Post a followup to this message

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