On Thu, Feb 16, 2012 at 6:53 PM, Brian Candler <b.candler / pobox.com> wrote:
> Is there some existing code (preferably ruby) which can take a regular
> expression and
> build a parse tree from it? e.g. I want to turn
>
> "^(foo|(bar|baz)*|qux)$"
>
> into something like this:
>
> <seq>
>     
> <bol>   > <alt>
> / | \
> foo <*> qux
> |
> <alt>
> / \
> bar baz
>
> or some equivalent representation of the regular expression itself.
>
> (The trouble is, when you google for 'ruby regular expression parser'
> you get all sorts of parsers written *using* regular expressions, not
> parsers *for* regular expressions!)

I don't have a good answer for your problem, but this question
reminded me of an old rubyquiz I have fond memories of :)

http://www.rubyquiz.com/quiz143.html

Jesus.