compile time regex

Philippe Sigaud philippe.sigaud at gmail.com
Sat Jun 16 23:24:52 PDT 2012


On Sat, Jun 16, 2012 at 10:50 PM, Dmitry Olshansky
<dmitry.olsh at gmail.com> wrote:
> On 17.06.2012 0:44, Ellery Newcomer wrote:
>>
>> There is a ctRegex; is there a compile time equivalent for match?
>
>
> No. Since last time I tried to hack through CTFE it failed horribly.
> Bleh, I'd rather first make sure that most regexes actually _compile_ at
> CTFE.

Ellery,

if you really need to match at CT, you can try Pegged:

https://github.com/PhilippeSigaud/Pegged/wiki

Be warned that while parsing at compile-time, it's not fast and will
probably eat RAM like there is no tomorrow  :)

Youkei is developping CTPG, which is from the same family:

https://github.com/youkei/ctpg/wiki/Home-en

For both projects, the grammar is a PEG, not a regex, but the syntax
is not that different. As PEG are more general, the engines are not
optimized like std.regex.


Philippe


More information about the Digitalmars-d-learn mailing list