* Regular expression matching against OCaml streams.
@ 2009-01-12 13:00 Dmitri Boulytchev
2009-01-12 14:34 ` [Caml-list] " Edgar Friendly
0 siblings, 1 reply; 4+ messages in thread
From: Dmitri Boulytchev @ 2009-01-12 13:00 UTC (permalink / raw)
To: caml-list
Hello,
is it possible to match OCam streams (by mean of Stream.t) against
regular expressions? Are there library
that can be used for this purpose? Str matches only against strings.
Best regards,
Dmiti Boulytchev,
St.Petersburg State University.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Regular expression matching against OCaml streams.
2009-01-12 13:00 Regular expression matching against OCaml streams Dmitri Boulytchev
@ 2009-01-12 14:34 ` Edgar Friendly
2009-01-12 15:49 ` Chris Conway
0 siblings, 1 reply; 4+ messages in thread
From: Edgar Friendly @ 2009-01-12 14:34 UTC (permalink / raw)
To: Dmitri Boulytchev; +Cc: caml-list
Dmitri Boulytchev wrote:
> Hello,
>
> is it possible to match OCam streams (by mean of Stream.t) against
> regular expressions? Are there library
> that can be used for this purpose? Str matches only against strings.
I don't know of any libraries for this purpose. I will warn anyone
making one that it's easy for simple regex matching to evaluate the
whole stream, and then fail to match.
Just a thought,
E
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Regular expression matching against OCaml streams.
2009-01-12 14:34 ` [Caml-list] " Edgar Friendly
@ 2009-01-12 15:49 ` Chris Conway
2009-01-12 16:59 ` [Caml-list] " Dmitri Boulytchev
0 siblings, 1 reply; 4+ messages in thread
From: Chris Conway @ 2009-01-12 15:49 UTC (permalink / raw)
To: caml-list
Edgar Friendly <thelema314 <at> gmail.com> writes:
>
> Dmitri Boulytchev wrote:
> > Hello,
> >
> > is it possible to match OCam streams (by mean of Stream.t) against
> > regular expressions? Are there library
> > that can be used for this purpose? Str matches only against strings.
>
> I don't know of any libraries for this purpose. I will warn anyone
> making one that it's easy for simple regex matching to evaluate the
> whole stream, and then fail to match.
Or worse, never terminate. E.g.,
stream_match "a*b" (Stream.from (fun _ -> Some 'a'))
Regards,
Chris
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Re: Regular expression matching against OCaml streams.
2009-01-12 15:49 ` Chris Conway
@ 2009-01-12 16:59 ` Dmitri Boulytchev
0 siblings, 0 replies; 4+ messages in thread
From: Dmitri Boulytchev @ 2009-01-12 16:59 UTC (permalink / raw)
To: caml-list
>> I don't know of any libraries for this purpose. I will warn anyone
>> making one that it's easy for simple regex matching to evaluate the
>> whole stream, and then fail to match.
>>
>
> Or worse, never terminate. E.g.,
>
> stream_match "a*b" (Stream.from (fun _ -> Some 'a'))
>
I do not see the problem in either case. If you has to match a long
string
you must be ready to fail. And if you are dealing with infinite data
structures
you must be ready not to terminate. At least these arguments did not
prevent OCaml
developers from implementing neither Stream nor, for example,
Lexing.from_function,
which definitely may be used to reproduce these malicious cases :)
Best regards,
DB.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-01-12 17:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-12 13:00 Regular expression matching against OCaml streams Dmitri Boulytchev
2009-01-12 14:34 ` [Caml-list] " Edgar Friendly
2009-01-12 15:49 ` Chris Conway
2009-01-12 16:59 ` [Caml-list] " Dmitri Boulytchev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox