[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: %union foo bar baz and others { ... }
From: |
Paul Eggert |
Subject: |
Re: %union foo bar baz and others { ... } |
Date: |
02 Mar 2003 01:06:42 -0800 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.3 |
Akim Demaille <address@hidden> writes:
> I don't know how ANTLR makes the difference between delayed code, and
> immediately executed code, that allows the implementation of something
> like a "cut" to prune the wrong parses.
I'm no ANTLR expert, but I think they put a "?" after the action,
E.g.:
stat:
{isTypeName(LT(1))}? ID ID ";"
| ID "=" expr ";"
;
The lexical analysis of {...}? actions in ANTLR does not seem to
differ from that of ordinary actions. I'd guess that the same would
be true for Bison; if so, it'll be trivial to add this syntax. If my
guess is wrong, though, there will be problems of course.
> The SC_AFTER_IDENTIFIER pieces of code is additional code,
> additional burden, that should be removed from Bison.
But this would remove code that supports a POSIX requirement. Even if
we decided not to conform to POSIX by default (which I don't yet see
the need for, due to backward-compatibility concerns), we would need
to conform if the POSIXLY_CORRECT environment variable is set. And to
do that, we would need SC_AFTER_IDENTIFIER, or something else equally
complicated. I don't see any easy way out of this complexity.
Hmm, perhaps you meant to say "SC_PRE_CODE" rather than
"SC_AFTER_IDENTIFER" here? It seems more relevant here. To my mind
the SC_PRE_CODE stuff is less defensible than the SC_AFTER_IDENTIFIER
stuff, as it supports something that is not a POSIX requirement, and
it's a worse hack to the lexer.