[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: x + (y) + z

From: Hans Aberg
Subject: Re: x + (y) + z
Date: Sun, 06 Mar 2005 18:56:14 +0100
User-agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.6

At 17:03 +0000 2005/03/06, Derek M Jones wrote:
>>You are not processing the C language, but some other language, with the
>>context dependencies of the C language removed.
>Correct.  I only claim to be processing C syntax on a
>single statement/declaration basis (and then only at the visible
>source level)..

>>Alternatively, you might introduce a new token-name both for type-names and
>>number-names. I.e., instead of
>>%token type-name number-name
>>you write
>>%token token-type-name
>>type-name: token-type-name;
>>number-name: token-type-name;
>>You then get a correct GLR parse, and can try to sort out the ambiguity
>I don't understand what you are getting at here.

You ignore the context information distinguishing between type-names and
number-names. So set these names equal to the same token, and let the GLR
parser handle it. It then produces all correct parses, including the
possible type-name/number-name choices. You then get the correct parse
trees, and need only decide how to select one over the other. Clearly, this
choice cannot be done, in general, unless you somehow supply the context
information missing.

  Hans Aberg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]