bug-bison
[Top][All Lists]
Advanced

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

Re: Grammar to large?


From: Hans Aberg
Subject: Re: Grammar to large?
Date: Sat, 1 May 2004 19:37:24 +0200

At 00:14 -0700 2004/05/01, Paul Eggert wrote:
>> Bison must probably have some knowledge of what the local language
>> escapes for "{" and "}" are (i.e., when these do not count as
>> matching braces).
>
>There's no way to do this for C (or C++) without lexically analyzing
>the token stream.  Other languages might differ, but we need not cross
>that bridge now.

I merely wanted to point out that if you want to implement a check against
the discussed type of error, then it should be done in such a way that it
does not make later multilanguage support more difficult. For a proper
multilanguage extension, one needs to classify the different things that
Bison needs to extract from the action codes, like the $$ and $k variables,
etc. Then, the next step would be to provide an easy way make language
specific implementations. Perhaps this might be to run the action-code
through M4 as well. If you want to fix this problem, then in fact you are
already taking the first steps on this path. :-)

One does not need a full C/C++ token analysis, only fine enough to extract
the information Bison needs for its translation. I am not sure exactly how
much though (I have not checked what exactly Bison does). Bison needs to
know when "{" and "}" should not be viewed as braces, which should be
within string (including #include directives) and character quotes and in
comments. Any other places?

  Hans Aberg






reply via email to

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