home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.compilers:1533 comp.human-factors:2171
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!udel!gvls1!faatcrl!iecc!compilers-sender
- From: torbenm@diku.dk (Torben AEgidius Mogensen)
- Newsgroups: comp.compilers,comp.human-factors
- Subject: Re: language design tradeoffs
- Keywords: design, parse
- Message-ID: <92-09-052@comp.compilers>
- Date: 8 Sep 92 11:07:58 GMT
- References: <92-09-048@comp.compilers>
- Sender: compilers-sender@iecc.cambridge.ma.us
- Reply-To: torbenm@diku.dk (Torben AEgidius Mogensen)
- Organization: Department of Computer Science, U of Copenhagen
- Lines: 37
- Approved: compilers@iecc.cambridge.ma.us
-
- kotula@cs.umn.edu asks about languages with EOL as command separator
- contra using a visible character (like ;).
-
- Several languages (e.g. Miranda) use EOL as separator. It gives an
- uncluttered syntax, but requires special structure if command or
- expressions can't fit on a line. Some languages (Haskell and some versions
- of BASIC) allow both EOL and e.g. ; as separators, thus allowing mixed
- notation.
-
- It is even possible to make grouping dependent on indentation: if the next
- line is indented more than the present, it is considered an extension of
- the present line. This approach is used in Haskell and something similar
- applies in Miranda (though the indentation is dependent on the position of
- keywords on the previous line).
-
- An example of this (in no particular language) is the following
- command/expression
-
- f
- g
- x
- y
- z
-
- which is equivalent to
-
- f(g(x,y),z)
-
- As for specifying a grammar for this, I believe it is better to handle the
- problem during the lexical analysis, making each new line generate one or
- more separators: "," if the indentation is the same, "(" if it is greater,
- and one or more ")" if it is smaller.
-
- Torben Mogensen (torbenm@diku.dk)
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-