On 10/6/06, Jan Svitok <jan.svitok / gmail.com> wrote:
> On 10/5/06, F. Senault <fred / lacave.net> wrote:
> > Hello.
> >
> > Where I work, we have to develop and maintain a quite huge application
> > fully written in Visual Basic 6 [1].
> >
> > Quite a few tasks should be automated, and being the magical-one-liner-
> > script guru of the workplace, I'm the one tasked with a bunch of things.
> >
> > So, I could continue to throw together bunches of ugly ruby and perl
> > scripts written each to achieve one specific goal, or I could try to
> > think a bit further and try to implement something more elegant,
> > powerful, and adaptable.
> >
> > But, to do that, I need to parse advanced VB6 code, to a quite fine
> > grained point.  For instance, detecting dead code and dead variables.
> >
> > I took a look at some projects out there, including full-fledged parsers
> > (none in ruby, or none fully useable, AFAI), but I didn't manage to do
> > much.
> >
> > Are there any solutions out there that I overlooked ?  Someone around
> > who has some experience in the domain to give pointers (though I'd
> > gladly accept code too... :) ) ?
>
> Just a few hints:
>
> - Joel Spolsky said they have a compiler from VB to PHP, although I'm
> a bit sceptic about whether he will release that (see
> http://www.joelonsoftware.com/items/2006/09/01b.html)
>
> - Zed Shaw has used ragel to build an http parser in mongrel, so if
> you end up writing a parser, you might have a look at his one (look
> for 'Mongrel grammar file' thread,
> http://rubyforge.org/pipermail/mongrel-users/2006-August/001241.html)
>

I don't think he'll be able to use Ragel to handle VB6. From some
searches, it looks like some of the VB6 syntax can't be expressed in
LALR, etc.
That being said, there are some pretty cool parser generators for
Ruby, so it could probably be done.