Related articles |
---|
language design tradeoffs kotula@milli.cs.umn.edu (1992-09-07) |
Re: language design tradeoffs torbenm@diku.dk (1992-09-08) |
Re: language design tradeoffs nr@dynastar.Princeton.EDU (1992-09-09) |
Re: language design tradeoffs raveling@Unify.com (1992-09-11) |
Re: language design tradeoffs weberwu@inf.fu-berlin.de (1992-09-13) |
Re: language design tradeoffs rob@guinness.eng.ohio-state.edu (1992-09-14) |
Re: language design tradeoffs tmb@arolla.idiap.ch (1992-09-14) |
Re: language design tradeoffs macrakis@osf.org (1992-09-15) |
[33 later articles] |
Newsgroups: | comp.compilers,comp.human-factors |
From: | torbenm@diku.dk (Torben AEgidius Mogensen) |
Organization: | Department of Computer Science, U of Copenhagen |
Date: | Tue, 8 Sep 1992 11:07:58 GMT |
Keywords: | design, parse |
References: | 92-09-048 |
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)
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.