[antlr-interest] Antlr grammar for regular expressions

Randall R Schulz rschulz at sonic.net
Tue Jul 31 08:10:14 PDT 2007


On Tuesday 31 July 2007 07:32, srđan bejaković wrote:
> I'm trying to write an engine that goes the other way, meaning it
> generates strings that conform to a regular expression (for
> populating data files for testing).

By the way, why don't you use the shell syntax for RE-based synthesis?

E.g.:

% showargs foo\ {is,may\ be,is{,\ definitely}\ not}\ bar
4 arguments:
        "foo is bar"
        "foo may be bar"
        "foo is not bar"
        "foo is definitely not bar"

(The backslashes are necessary because in the BASH shell quoting an 
argument inhibits brace expansion.}


When I wrote that old C regular expression library, I had modular 
front-end parsers, since there were and continue to be so many dialects 
of regular expression, including highly disparate ones such as the 
shell's brace-expansion notation.


Randall Schulz


More information about the antlr-interest mailing list