comp.lang.ada
 help / color / mirror / Atom feed
From: "Jean-Pierre Rosen" <rosen.adalog@wanadoo.fr>
Subject: Re: Lexical Conundrum
Date: 1998/02/23
Date: 1998-02-23T00:00:00+00:00	[thread overview]
Message-ID: <6crnal$9ei$1@peuplier.wanadoo.fr> (raw)
In-Reply-To: 01bd3d80$101287c0$LocalHost@xhv46.dial.pipex.com


Nick Roberts a �crit dans le message
> [...]
>But, if you look closely at line 6, you will see the sequence
>
>   or'a'in
>
>in the middle of an expression.
>
>Now, from chapter 2 of the RM, one might get the impression that this could
>be parsed as five lexical elements (three identifiers and two apostrophes).
> Of course, if a compiler were to parse it that way, the result would be a
>syntax error.
> [..]
>One immediate conclusion, I think, is that the introduction of a one-letter
>attribute (in an implementation of the language) could cause difficulties!
>Of course, it's hard to imagine a motive for such an attribute, in
>practice.
>
>Question: would a compiler be in contravention of the RM by rejecting the
>above program (with a syntax error in line 6)?  I admit that such a
>compiler may be considered to be poorly designed!
>
This a known (and presumably only) small difficulty in parsing Ada. And yes,
compilers may take advantage that there is no one letter attribute to make
it easier... although it's not really hard to solve. For example, have a
look at the very simplistic parser used in "normalize" (a utility available
from Adalog's Web site at http://perso.wanadoo.fr/adalog).

BTW, you can make things more difficult. Consider:
if Boolean'('a'='b') then ...






  parent 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
1998-02-23  0:00     ` Keith Thompson
1998-02-23  0:00       ` Robert Dewar
     [not found]     ` <Eou91J.Es9@world.std.com>
1998-02-23  0:00       ` Robert Dewar
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 [this message]
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