Steve Fink wrote:
> 
> On Apr-03, Benjamin Goldberg wrote:
> >
> > I've been looking over the rx.ops, and am amazed at how cool it is :)
> >
> > I'm wondering, however -- was this based on something else?
> 
> I believe Brent cooked it up more or less from scratch. It also served
> as the inspiration for a couple more attempts at a perl6 regex
> compiler.
> 
> > That is, does there exist some utility which translates regexen into
> > C (or assembly) code, similar to how we translate regexen into parrot
> > code?
> 
> I've never used it, but PCRE looks like a very nice regex -> C
> compiler.

PCRE is like most/all other regex engines other than the parrot one --
it compiles to an internal form, which is then interpreted.

It's big plus is that the syntax it uses for it's regexen, and the set
of features it supports, is very similar to Perl's.

> > I've been searching, but all I've seen are tools to compile regexen
> > into tree-like data structures, and these structures are then
> > interpreted.
> 
> My parrot/languages/regex compiler only does regex -> parrot, but the
> parrot code is a "direct" implementation, not a tree interpreter. It
> does not use the rx.ops instructions; it just uses regular pasm
> instructions and data structures.

Maybe once I grok your compiler, I'll write a version which outputs to
C.

> However, I'm not sure what state the currently committed version is
> in. My local copy is much advanced, though mostly just in the area of
> integration with the languages/perl6 compiler. (I haven't committed it
> because it still doesn't pass Sean's old regex test suite in t/rx,
> although even then it is more advanced than the current perl6 regex
> implementation.)
> 
> More unfinished work: I have a detailed description of part of the
> implementation written, although I never finished it off enough to
> release. I'll put up my current draft version at
> <http://0xdeadbeef.net/~sfink/uploads/regex.pod>.
> 
> > I wanna see a *real* regex compiler, which compiles down to C or
> > native code. :)
> 
> Check out PCRE. Although a regex -> parrot -> JITted native code will
> hopefully be nearly as fast. ;-)

Maybe one day when I understand assembly sufficiently well (in the far,
far, distant future, I suspect), I'll write a jit regex->native
compiler. :)

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "[EMAIL PROTECTED]
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}

Reply via email to