[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Featuritis: Token actions
From: |
Frank Heckenbach |
Subject: |
Re: Featuritis: Token actions |
Date: |
Thu, 24 Jul 2003 18:14:00 +0200 |
User-agent: |
semail 20030303 |
Hans Aberg wrote:
> If one should do such a combination, then that is perhaps that such
> immediate action tokens, when arriving, are put in a queue, until a real
> (non-action) token arrives. Then the actions of the queued tokens are
> executed when the parser discovers that the real token must be shifted onto
> the stack. That should give the right action, right?
I think so.
In fact, this might be a little better than my solution where the
action (via locations) is done when the token is reduced, because
shifting always happens in order, while reducing may not (e.g.,
`1 + 2 * 3' will reduce the `2 * 3' tokens before `1 + '). In my
code, I had to work around this problem (which wasn't too hard,
though). So this feature might be useful for me, though not
essential.
BTW, I think we'd get essentially the same power if there was a way
to stick actions to a token (independent of the token value), i.e.
basically just a way to invoke some user-defined routine when a
token is shifted. This would shift (pun intended) some work from
bison (no queue required) to the user's code -- I don't know what's
generally considered preferable ...
Frank
--
Frank Heckenbach, address@hidden
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)