[antlr-interest] Antlr grammar for regular expressions

Kay Roepke kroepke at classdump.org
Tue Jul 31 07:53:17 PDT 2007


On Jul 31, 2007, at 3:27 PM, srđan bejaković wrote:

> does anyone know of an Antlr grammar for parsing (perl or java)  
> regular
> expressions? I started implementing something like this, but I  
> don't want to
> (suboptimally) reinvent something that probably already exists.  
> Thanks,

I have not come across one, sadly. It would be nice to have for the  
reasons mentioned
by others. Especially for really unreadable regexes ;)

Just found this: <http://www.zenspider.com/Languages/PCCTS/ 
Grammars.html>, but it's not what I'd call complete...

What kind of level of support do you need? If you are shooting for a  
complete Perl5 regex grammar, it could
become involved (esp. if you need to support things like Perl's  
extended regexes, with its lookahead assertions
and the like), but if you just want to stick with the "traditional"  
subset, it shouldn't be too hard to pull off.

I'm kinda interested in building something like this, if only to see  
my colleagues gasp ;)
And for generating tests it's nice, too...

cheers,
-k
-- 
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list