Related articles |
---|
[11 earlier articles] |
Re: Buffered input for a lexer? cgweav@aol.com (2002-03-31) |
Re: Buffered input for a lexer? bear@sonic.net (Ray Dillinger) (2002-04-10) |
Re: Buffered input for a lexer? bear@sonic.net (Ray Dillinger) (2002-04-10) |
Re: Buffered input for a lexer? cgweav@aol.com (2002-04-13) |
Re: Buffered input for a lexer? ralph@inputplus.co.uk (2002-04-16) |
Re: Buffered input for a lexer? joachim_d@gmx.de (Joachim Durchholz) (2002-04-16) |
Re: Buffered input for a lexer? cgweav@aol.com (2002-04-17) |
Re: Buffered input for a lexer? rhyde@cs.ucr.edu (Randall Hyde) (2002-04-19) |
Re: Buffered input for a lexer? monnier+comp.compilers/news/@RUM.cs.yale.edu (Stefan Monnier) (2002-04-19) |
Re: Buffered input for a lexer? rhyde@cs.ucr.edu (Randall Hyde) (2002-04-20) |
Re: Buffered input for a lexer? joachim_d@gmx.de (Joachim Durchholz) (2002-04-23) |
Re: Buffered input for a lexer? bear@sonic.net (Ray Dillinger) (2002-04-23) |
Re: Buffered input for a lexer? rhyde@cs.ucr.edu (Randall Hyde) (2002-04-23) |
From: | cgweav@aol.com (Clayton Weaver) |
Newsgroups: | comp.compilers |
Date: | 17 Apr 2002 23:18:50 -0400 |
Organization: | AOL http://www.aol.com |
References: | 02-04-097 |
Keywords: | lex, practice |
Posted-Date: | 17 Apr 2002 23:18:50 EDT |
[]
>> I actually think it would make sense if an editor's language mode just
>> did it automatically (terminate all saved source files with a single
>> end-of-line in the native syntax of the host system when you save the
>> file).
[]
>I think it makes more sense to have the language processor properly
>interpret lines without an end-of-line.
Sure, the lexical analyzer should catch the case where, for whatever
reason, the source text does not end in "end-of-line" (whatever that
may be on a particular system) without failing, because it is cheap to
do and allows a compile to complete that does not necessarily compile
to wrong code. A warning from the lexer is reasonable, in case there
happens to be more "missing" than just the newline.
But that goes both ways: while the parser *should* catch the "unusual"
case and at least report it while still proceeding with the compile,
the programmer that edits the source code should likewise strive to
write code that avoids any obvious possible corner cases in mere
lexical analysis that some lexer/parser happens to not deal with
gracefully.
The extra fault-tolerance, imho, is worth the length of the line end
in filesystem storage (and if you put it in the editor mode, you don't
even have to think about it to have it).
I agree with Ray's objection to my original post, that having the
lexer add the line end to the disk file if it's not there and possibly
breaking makefile/version_control dependencies in the process is
unnecessarily BOFH behavior for a lexer.
Regards,
Clayton Weaver
<mailto: cgweav@aol.com>
Return to the
comp.compilers page.
Search the
comp.compilers archives again.