This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Very Fast: Directly Coded Lexical Analyzer
- From: Andi Kleen <andi at firstfloor dot org>
- To: "Frank Schaefer" <frank_r_schaefer at gmx dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: 31 May 2007 17:15:03 +0200
- Subject: Re: Very Fast: Directly Coded Lexical Analyzer
- References: <20070531131945.56410@gmx.net.suse.lists.egcs>
"Frank Schaefer" <frank_r_schaefer@gmx.net> writes:
>
> Is there any interest in using such an engine in the GCC toolset?
Right now gcc doesn't use flex so it would be probably non trivial
to implement support. You would need to rewrite c-lex.c
> It would be an honor for me to provide any adaptions you require.
> Anyway, quex's syntax is mostly conform to flex/lex, so there is
> not much 'getting used to' with this generator. I am also positive,
> that it is very hard to program a hand-written analyzer that is faster,
> since the engine does not do any house-keeping and profits from Hopcroft-
> Optimization and Binary-Search for code generation. These things are
> hard to to by hand.
Normally switch() uses reasonable algorithms which gcc's c-lex.c uses.
I suspect for common symbols using a pure table lookup vs calling special
code would be faster on many CPUs though (computed jumps are often slow
because they tend to cause branch mispredicts)
-Andi