develooper Front page | perl.perl5.porters | Postings from October 2014

Re: Bringing the regex compiler into the current millenium.

Thread Previous
From:
demerphq
Date:
October 23, 2014 14:38
Subject:
Re: Bringing the regex compiler into the current millenium.
Message ID:
CANgJU+UQMx4MQHpJn1X6LrOD9AG3kTJ_YXp3bxzY7OZDLW2tbw@mail.gmail.com
On 23 October 2014 15:47, Aaron Crane <arc@cpan.org> wrote:

> Dave Mitchell <davem@iabyn.com> wrote:
> > On Thu, Oct 23, 2014 at 10:15:05AM +0200, demerphq wrote:
> >> 1. Change the current awkward multi-pass lexer, into a single pass lexer
> >> which constructs an AST which is then analysed and optimised, which woud
> >> then be used to produce the final encoded program.
> >
> > That sounds great. My only proviso would be that you use some sort of
> > slab or arena system for allocating the AST nodes, to avoid lots of
> > mallocs.
>
> I was thinking much the same thing. The nice thing about preserving
> the existing "sequence of regnodes" output structure is that any slabs
> used for allocating the AST nodes can be easily discarded at the end
> of regex compilation. Another way of looking at that is that the AST
> would replace the regex compiler's sizing pass, but in a form that
> promotes analysis and rewriting.
>

Yes precisely. Although I quibble about the reference to slabs. Once we had
first order regnodes with real pointers to the next regop and etc, we can
do all the analysis we need. The slabs are just an optimization on top of
the basic AST stuff.

Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About