[Top][All Lists]

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

Re: Featuritis: Token actions

From: Hans Aberg
Subject: Re: Featuritis: Token actions
Date: Thu, 24 Jul 2003 12:51:33 +0200

At 18:49 +0200 2003/07/23, Frank Heckenbach wrote:
>> I think this might be used to solve some of the things requested by others.
>Maybe you're referring to my request re "Finding out when a token is
>consumed". However AFAIUI, you do the token action immediately after
>getting the token from the lexer. So it doesn't seem much different
>from doing the action in the lexer.

The difference is that the lexer does not see the things that the parser
can do. One putting that stuff in a common header (assuming the
lexer/parser sources are separate).

>> As for myself, I wanted to implement the parse debug on/off feature, and
>> therefore started to think along these lines.
>If you want it to work at the point where the "grammatical location"
>actually reaches the debug on/off token (and not already when it's
>read as a look-ahead token), you basically have the same problem I
>had with my directives (which I solve by abusing the location
>actions as you might remember).
>(E.g., with `1 + 2 debug-on + 3' in a usual arithmetic grammar, your
>suggestion would turn on debugging before the first addition is

I guess that is the problem I am hitting at, except that I am at this point
in time not so finicky about exactly when it is turned on/off.

But if the requirement is very detailed on/off debugging, then one lands at
your problem, I figure. Then my idea should perhaps be combined with that.

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?

Then one should insert the execution if the token actions of the queued
tokens at the point where the skeleton file says:
  /* Shift the lookahead token: */

Actually, there might be two types of token actions: Immediate and delayed.
Immediate would execute as soon as the parser discovers it. Delayed waits
until there is another stack shift.

  Hans Aberg

reply via email to

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