Related articles |
---|
[16 earlier articles] |
Re: Is the dangling else a syntax bug? marcov@toad.stack.nl (2001-07-23) |
Re: Is the dangling else a syntax bug? joachim_d@gmx.de (Joachim Durchholz) (2001-07-23) |
Re: Is the dangling else a syntax bug? vbdis@aol.com (2001-07-27) |
Re: Is the dangling else a syntax bug? wb@vestein.arb-phys.uni-dortmund.de (2001-07-30) |
Re: Is the dangling else a syntax bug? mike@dimmick.demon.co.uk (Mike Dimmick) (2001-07-30) |
Re: Is the dangling else a syntax bug? wclodius@aol.com (2001-07-30) |
Re: Is the dangling else a syntax bug? joachim_d@gmx.de (Joachim Durchholz) (2001-07-30) |
Re: Is the dangling else a syntax bug? marcov@toad.stack.nl (2001-08-02) |
Re: Is the dangling else a syntax bug? vbdis@aol.com (2001-08-02) |
Re: Is the dangling else a syntax bug? stephen_bevan@yahoo.com (2001-08-06) |
From: | "Joachim Durchholz" <joachim_d@gmx.de> |
Newsgroups: | comp.compilers |
Date: | 30 Jul 2001 01:26:03 -0400 |
Organization: | Compilers Central |
References: | 01-07-133 01-07-153 |
Keywords: | design |
Posted-Date: | 30 Jul 2001 01:26:02 EDT |
VBDis <vbdis@aol.com> wrote:
> "Joachim Durchholz" <joachim_d@gmx.de> schreibt:
>
> >An interesting variation of this is the use of unindentation as "end"
> >marker. This has been done e.g. in Python and Haskell.
>
> Did you ever see source code with a mix of tab and space characters?
> Such text becomes unreadable to both a human and a compiler, when the
> tab size is changed to some user defined value. The whole source code
> then is bound to a specific editor :-(
Yes. I don't know how the language communities handle this.
In practice, the problem is two problems:
1) The source code becomes unreadable.
2) Ambiguities on the interpretation of tabs.
Problem (1) is a problem for all languages with indentation.
I had problem (2) solved in my own toy language by requiring that two
consecutive lines must have "compatible" initial whitespace, i.e. it
must either be the exactly same sequence of tabs and space, or the
whitespace of one line must be a proper prefix of the whitespace of
the other line. (This isn't the whole story, multiple indentation
poses some problems.)
> The use of EOL as a delimiter was discussed in a recent thread, and I
> think that it's not a practical solution. Then at least continuation
> lines must be introduced at the same time, to allow to break long
> lines into multiple shorter lines.
Or every construct must have a multiple-line equivalent.
Early Basics allowed you to write
IF cond THEN statement
or
IF cond
statements
END IF
which was quite handy at time (though the language as a whole sucked).
> [Line-oriented languages with continuation markers work fine. I used
> to use one, For-something. -John]
Don't know why, continuation marers are making life miserable in C.
Reformatting code in a multi-line macro is a pain.
Regards,
Joachim
[As someone noted above, they work fine in Fortran. C gives you the worst
of both worlds, line oriented preprocessor, token oriented everything else.
-John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.