From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,3b05f12bd7a2a871 X-Google-Attributes: gid103376,public From: "Jean-Pierre Rosen" Subject: Re: Lexical Conundrum Date: 1998/02/23 Message-ID: <6crnal$9ei$1@peuplier.wanadoo.fr>#1/1 X-Deja-AN: 327799783 Content-Transfer-Encoding: 8bit References: <01bd3d80$101287c0$LocalHost@xhv46.dial.pipex.com> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Adalog Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-02-23T00:00:00+00:00 List-Id: 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 ...