help-flex
[Top][All Lists]
Advanced

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

Re: Optmizing a flex scanner.


From: Jonathan S. Shapiro
Subject: Re: Optmizing a flex scanner.
Date: Mon, 11 Apr 2005 13:15:08 -0400

Roberto:

Automated generators usually aren't a good strategy for designing fast
scanners. As a general rule, real languages divide into three
categories:

  1. Experimental (i.e. optimization is premature)
  2. Mostly frozen, relatively simple (i.e. optimization
     makes sense)
  3. Too complex to implement by hand (pragmatically
     not optimizable).

For category (2), there is no reason in *principle* why flex (or similar
tools) should not generate well-optimized scanners, but the table driven
strategy is usually not well suited to this, and the algorithm synthesis
process used by a human does not match the synthesis strategy used by
the generator (and probably cannot).

So:

The biggest optimization that is usually possible is keyword analysis.
The customary strategy is to match identifiers using the flex, and then
in the action rule pick off the keywords using a hand-crafted algorithm.

shap

On Mon, 2005-04-11 at 17:02 +0200, Roberto Diaz wrote:
> Hi everybody.
> 
> 
> I would like to ask you about hints about how to optimize a flex scanner
> for performance.
> 
> Are there some general guidelines? could you point me out to some
> references? 
> 
> Thank you very much
> 
> Roberto
> 
> 
> 
> _______________________________________________
> Help-flex mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-flex





reply via email to

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