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: Fri, 30 Apr 2004 18:57:51 +0200

At 01:46 -0700 2004/04/29, Paul Eggert wrote:
>... the problem is here:
>
>opt_nowait:    NOWAIT                   { $$ = make_str("nowait); }
>
>and Bison assumes the rest of your grammar is in the C string.
>
>Perhaps Bison should reject strings (and chars) that attempt to cross
>line boundaries.  That used to be a GCC extension, but has been
>removed recently.

I could be that such language specific behavior within the actions becomes
increasingly difficult to support when Bison becomes multilingual in output.

A thing that might be easy to implement, though, is that Bison merely
checks the pairs "{...}" according to a standard parenthesis checking
algorithm, does the usual processing of $k, $$, etc, and then exports
whatever it found to the parser action. In the example above, the action
text would be
 $$ = make_str("nowait);
It will thus generate a compile error when the parser is compiled.

This seems to be the best way to handle multilingual support in the
actions: It is going to be too tough to keep track of language rules of
many languages.

One problem with this idea though, is that one can write fully legally an
action:
  opt_nowait:    NOWAIT           { $$ = make_str("}"); }
So 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).

  Hans Aberg






reply via email to

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