comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Lexical Conundrum
Date: 1998/02/23
Date: 1998-02-23T00:00:00+00:00	[thread overview]
Message-ID: <dewar.888251983@merv> (raw)
In-Reply-To: 888217846.855378@wagasa.cts.com


Keith says

<<The C language definition resolves this kind of thing by mandating that
lexical analysis is "greedy", i.e., that the lexical analyzer always
forms the longest lexical token that it can, regardless of whether it
will cause problems later.  This is sometimes referred to as "maximal
munch".  (This makes the lexer somewhat easier to write -- and, far more
importantly, IMHO, makes the lexical legality rules easier to describe.)
>>

I don't see this (lexical legality rules easier to describe). There is
no problem in the lexical legality rules in Ada. There are rules for
each lexical token that are clear, and rules for how they are written
down in a sequence.

I suppose it might be nice if one can immediately tell how tokens are
broken up with no additional information, but in practice this is a
problem neither for the Ada programmer, nor for the Ada compiler writer,
since there are never any ambiguities.

C needs the greedy rule because indeed in its absence the C language
would be ambiguous. No such ambiguities exist in Ada, so there is no
need for a disambiguating rule.





  reply	other threads:[~1998-02-23  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-19  0:00 Lexical Conundrum Nick Roberts
     [not found] ` <EotBMK.MnK@world.std.com>
1998-02-22  0:00   ` Robert Dewar
     [not found]     ` <Eou91J.Es9@world.std.com>
1998-02-23  0:00       ` Robert Dewar
1998-02-23  0:00     ` Keith Thompson
1998-02-23  0:00       ` Robert Dewar [this message]
1998-02-26  0:00     ` Dr Steve Sangwine
1998-02-23  0:00   ` Mark A Biggar
1998-02-24  0:00     ` Mats Weber
1998-02-24  0:00       ` Robert Dewar
1998-03-05  0:00         ` Robert I. Eachus
1998-02-23  0:00 ` Jean-Pierre Rosen
1998-02-23  0:00   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1998-02-22  0:00 Nick Roberts
1998-02-22  0:00 ` Robert Dewar
1998-02-24  0:00   ` John Roberts-Jones
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox