[EMAIL PROTECTED] (Marcin 'Qrczak' Kowalczyk) wrote,

> 28 Sep 2000 11:09:28 +0200, [EMAIL PROTECTED] <[EMAIL PROTECTED]> pisze:
> 
> > Doaitse Swierstra's [This is the correct spelling!] parser combinators
> > in their newest incarnation have symbol ranges as their basis.
> > Internally they are also used to allow binary search
> 
> Certainly better than character lists.
> 
> I'm not sure if basing on character predicates would not be better.
> E.g. these 45443 isAlpha characters are split into 255 ranges.
> 
> My character category table is internally implemented as 256 vectors
> of 256 vectors of categories (all characters larger than '\xFFFF'
> currently have the same category).
> 
> Even though eight comparisons is not much compared to two table
> lookups, neither Haskell98 nor my library provides easy access to
> character ranges for predicates like isAlpha.
> 
> It would not be a problem to provide it, but it makes the interface
> almost twice bigger.

I agree that usually the predicates as proposed by you would
be better.  The problem is that a scanner that wants to use
the usual finite deterministic automation techniques for
scanning, needs to be able to compute the overlap between
different predicates.

Manuel

Reply via email to