[Haskell-cafe] Re: ANN: weighted-regexp-

Sebastian Fischer sebf at informatik.uni-kiel.de
Thu Jul 29 06:18:23 EDT 2010

Hello Chris,

thanks for the examples. They show that by adding anchors, the meaning  
of regular expressions is no longer compositional. For example  (^|a)   
accepts the empty word only if no characters have been read yet. So

     (^|a) =~ ""

does hold but

     a(^|a) =~ "a"

does not hold although

     a =~ "a"


I deem compositionality an important property to compare the current  
implementation with its specification. As, currently, I don't know how  
to incorporate anchors without making a mess, I refrain from adding  
them for the moment.

> A more complicated use, perhaps as part of a crazy parser:
> "(a(\n)?)(^|b)(c|$)"

That's a nice example and I don't know how to express this without  


Underestimating the novelty of the future is a time-honored tradition.

More information about the Haskell-Cafe mailing list