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

Re: Bringing the regex compiler into the current millenium.

Thread Previous | Thread Next
From:
Aaron Crane
Date:
October 23, 2014 13:47
Subject:
Re: Bringing the regex compiler into the current millenium.
Message ID:
CACmk_tsHjzvGVyi1_jg55Xmpnu6TbJhMUUjkcQb62MJ-Fb+27Q@mail.gmail.com
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.

-- 
Aaron Crane ** http://aaroncrane.co.uk/

Thread Previous | Thread Next


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