comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: lexical ambiguity
Date: Wed, 7 Jun 2006 11:02:51 +0200
Date: 2006-06-07T11:02:41+02:00	[thread overview]
Message-ID: <19ibym5lwjybs$.1pkufcf0ck917$.dlg@40tude.net> (raw)
In-Reply-To: tz1wu2tsyp.fsf@hod.lan.m-e-leypold.de

On 06 Jun 2006 13:38:06 +0200, M E Leypold wrote:

> Georg Bauhaus <bauhaus@futureapps.de> writes:
> 
>> On Mon, 2006-06-05 at 22:11 +0000, Jeffrey R. Carter wrote:
>>> Keith Thompson wrote:
>>> > 
>>> > If I recall correctly, it's sufficient to remember what the previous
>>> > token was.  A character literal cannot follow an identifier.
>>> 
>>> Right, so it must be either an attribute, a qualified expression, or an 
>>> error. 
>> 
>> Though the previous token shouldn't be a reserved word, as in
>> 
>>  if'('="-"("="('='=',',','=','))
> 
> Or 
> 
>    return'a'; 
> 
> So now (question to all): Is the following rule enough?
> 
>    - "'" is the beginning of a character literal if the token before
>      "'" has not been an identifier (reserved words not counted as
>      identifier in this case).

It does not differ from the case of +/-. In the infix context, i.e. after
an operand (whatever it might be), ' is an infix operation as well as +/-.
In the prefix context, where an operand is expected ' introduces a
character literal (=operand), +/- do an unary prefix operation.

Your rule is wrong: 'A' and 'B'. "and" is a reserved word. Then of course
"..." comments should be parsed before. Which gives you a nice vicious
circle around ' " ' and " ' ". (:-))

The bottom line: parsing has state.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2006-06-07  9:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-02 22:13 lexical ambiguity bla_bla1357
2006-06-02 22:35 ` Frank J. Lhota
2006-06-03  5:20   ` Jeffrey R. Carter
2006-06-04 17:33     ` Frank J. Lhota
2006-06-05  1:36       ` Jeffrey R. Carter
2006-06-05 18:30         ` Frank J. Lhota
2006-06-05 20:27           ` Keith Thompson
2006-06-05 22:11             ` Jeffrey R. Carter
2006-06-06 10:39               ` Georg Bauhaus
2006-06-06 11:38                 ` M E Leypold
2006-06-07  9:02                   ` Dmitry A. Kazakov [this message]
2006-06-07 13:15                   ` Georg Bauhaus
2006-06-07 14:49                   ` Robert A Duff
2006-06-07 17:18                     ` M E Leypold
2006-06-08 21:30                       ` Robert A Duff
2006-06-09  4:41                       ` Jeffrey R. Carter
2006-06-09  8:23                       ` Georg Bauhaus
2006-06-06 13:50                 ` Simon Clubley
2006-06-06 18:56                 ` Peter C. Chapin
2006-06-06 19:41                   ` Georg Bauhaus
2006-06-05 22:16           ` Jeffrey R. Carter
2006-06-06 13:20             ` Frank J. Lhota
2006-06-02 23:27 ` Keith Thompson
replies disabled

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