[Top][All Lists]

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

Re: Faster token table lookups

From: Hans Aberg
Subject: Re: Faster token table lookups
Date: Wed, 20 Dec 2000 21:48:31 +0100

At 11:42 +0100 0-12-20, Akim Demaille wrote:
>> ... to those that want to make a
>> lot of name table lookups. I think there is a suggestion one can
>> implement it in the lexer function yylex: instead of returning a
>> macro number directly, it makes a table lookup, and returns that
>> number to Bison.
>Then why not, send a patch :)

If it is a Bison patch you are asking for, I may do so if I start to use
the feature. The implementation itself is not so difficult, I think: Just
put the names on a std::map together with the Bison lookup numbers as
values, and then write that map out. Then all you at Gnu has to do is
turning the patch over to the Gnu C++-to-C rewriting team. :-)

- Actually, it is OK with Bison to simply write
  %token "=>"
instead of
  %token implies "=>"
and if one is doing that, the only way to find Bison's lookup number in the
yylex function is to use the lookup table.

- One could speed up the lookup even further by caching the numbers so
found, even though I do not see the details of such an implementation yet.

  Hans Aberg

reply via email to

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