Re: Buffered input for a lexer?

Joachim Durchholz <joachim_d@gmx.de>
16 Apr 2002 00:53:58 -0400

          From comp.compilers

Related articles
[10 earlier articles]
Re: Buffered input for a lexer? joachim_d@gmx.de (Joachim Durchholz) (2002-03-31)
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)
[1 later articles]
| List of all articles for this month |

From: Joachim Durchholz <joachim_d@gmx.de>
Newsgroups: comp.compilers
Date: 16 Apr 2002 00:53:58 -0400
Organization: Compilers Central
References: 02-04-061 02-04-081
Keywords: lex, practice
Posted-Date: 16 Apr 2002 00:53:58 EDT

Clayton Weaver wrote:
> 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). It's absurd to leave something so simple up to the programmer
> when you consider how small a job this is compared to all of the other
> specialized editor code that goes into a programming-language-specific
> editing mode.


I think it makes more sense to have the language processor properly
interpret lines without an end-of-line. It's just good programming
practice to have an as small set of constraints on the input as is
reasonable.


I happen to be nearly done with a handcrafted lexer right now, and
while handling boundary cases like this wasn't exactly child's play, I
have encountered no serious problems. It was all just an exercize in
organizing the data flow and putting the "if" statements into the
right levels of abstraction. (Interpreting end-of-file as end-of-line
was just one boundary condition that I had to consider, and actually
one of the easier ones.)


Post a followup to this message

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