Discussion:
[ragel-users] Expressing PCREs in Ragel
Ellis Breen
2013-03-19 12:20:51 UTC
Permalink
Hi all,

Is there a semantic element, preprocessor or component that will allow me
to express standard PCREs in Ragel?

I'm not trying to implement a regex engine, but to find the intersection of
two PCRE search patterns. I believe I've managed to do this by manually
rewriting PCREs into Ragel format, but I'd like to automate the process, as
I have a large number of PCREs to compare.

Any hints on how I can do this with Ragel, or an alternative?

This appears to be about the closest I've found to what I need.

Many thanks,

Ellis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.complang.org/pipermail/ragel-users/attachments/20130319/c595a810/attachment.html>
Adrian Thurston
2013-03-25 02:35:37 UTC
Permalink
Not that I'm aware of.

You'll need some parse/transform pass for PCRE to ragel. I'm no expert
on PCRE syntax, so I can't really comment on how difficult it will be.

I can say PCRE and ragel use different implementation techniques though,
so you may run into some road blocks on those grounds. Ragel is pure
DFA, while PCRE uses some mix of DFA and an interpretor that backtracks.

-Adrian
Post by Ellis Breen
Hi all,
Is there a semantic element, preprocessor or component that will allow
me to express standard PCREs in Ragel?
I'm not trying to implement a regex engine, but to find the intersection
of two PCRE search patterns. I believe I've managed to do this by
manually rewriting PCREs into Ragel format, but I'd like to automate the
process, as I have a large number of PCREs to compare.
Any hints on how I can do this with Ragel, or an alternative?
This appears to be about the closest I've found to what I need.
Many thanks,
Ellis
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
Ellis Breen
2013-04-17 17:19:04 UTC
Permalink
I just wanted to say thanks for answering my query. In the end I wrote a
preprocessor, but went with the brics.automaton Java package instead.
Didn't get round to implementing zero-width assertions, etc, though, but I
was at least able to determine whether two regexes (regices?) intersected,
if not whether they interfere with one another. There doesn't seem to be
much in terms of OSS packages working in this domain otuside of some Python
( http://qntm.org/greenery ) , Perl (
http://search.cpan.org/~estrabd/FLAT-0.9.1/ )and Haskell (
https://code.google.com/p/xhaskell-library/) libraries. Perhaps a full
blown regex parser could be implemented in Ragel itself, reifying its
compile-time DFA-generation abilities? I couldn't see a way of extending
Ragel's syntax itself (short of digging deep into the code). Great library,
anyway, and perhaps this post will be of use to others following this
trail. Or perhaps they will heroically dive in and extend Ragel. In my
case, I used the quick and dirty solution of preprocessing and off-the-peg
Java DFA library, which was relatively satisfactory, although I think still
need to dive into the automaton code to cover extended regex syntax.
Post by Adrian Thurston
Not that I'm aware of.
You'll need some parse/transform pass for PCRE to ragel. I'm no expert on
PCRE syntax, so I can't really comment on how difficult it will be.
I can say PCRE and ragel use different implementation techniques though,
so you may run into some road blocks on those grounds. Ragel is pure DFA,
while PCRE uses some mix of DFA and an interpretor that backtracks.
-Adrian
Post by Ellis Breen
Hi all,
Is there a semantic element, preprocessor or component that will allow
me to express standard PCREs in Ragel?
I'm not trying to implement a regex engine, but to find the intersection
of two PCRE search patterns. I believe I've managed to do this by
manually rewriting PCREs into Ragel format, but I'd like to automate the
process, as I have a large number of PCREs to compare.
Any hints on how I can do this with Ragel, or an alternative?
This appears to be about the closest I've found to what I need.
Many thanks,
Ellis
______________________________**_________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/**mailman/listinfo/ragel-users<http://www.complang.org/mailman/listinfo/ragel-users>
______________________________**_________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/**mailman/listinfo/ragel-users<http://www.complang.org/mailman/listinfo/ragel-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.complang.org/pipermail/ragel-users/attachments/20130417/425ed4ac/attachment.html>
Loading...