bug-bison
[Top][All Lists]
Advanced

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

Re: GLR: modification of $1


From: Paul Eggert
Subject: Re: GLR: modification of $1
Date: 01 Oct 2003 21:32:37 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Frank Heckenbach <address@hidden> writes:

> Perhaps a stupid question, but are the `$1' etc. variables read-only
> (in particular, in mid-rule actions)?

Traditionally, they were read-write.  The POSIX spec is muddled in
this area.  However, even if it clearly stated that they are
read-write, that requirement would apply only to the traditional
yacc.c template; it wouldn't apply to the GLR template.

> The examples in the documentation don't seem to modify
> them, but other parsers do (e.g., the gcc C parser does so for
> handling `&&' etc.).

(Blush.)  I'm responsible for some of those contorted grammars.

> If modification is actually allowed, there seems to be a bug in the
> GLR parser (tested with 1.875b since I can't easily build the CVS
> versions).

If modification is not allowed in GLR parsers, perhaps glr.c should be
changed so that $1 expands to a const-qualified object; that way,
errors will be caught at compile-time.




reply via email to

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