[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Parsing visual basic

F. Senault

10/5/2006 7:15:00 PM

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... :) ) ?

Fred
[1] : This is the point where everyone goes hiding behind the couch...
--
Science is always discovering odd scraps of magical wisdom and making a
tremendous fuss about its cleverness. (Aleister Crowley)
7 Answers

Timothy Goddard

10/5/2006 10:03:00 PM

0

F. Senault 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... :) ) ?
>
> Fred
> [1] : This is the point where everyone goes hiding behind the couch...
> --
> Science is always discovering odd scraps of magical wisdom and making a
> tremendous fuss about its cleverness. (Aleister Crowley)

Beware, that way lie patents.

Mike Durham

10/6/2006 12:14:00 AM

0

Timothy Goddard wrote:
> F. Senault 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... :) ) ?
>>
>> Fred
>> [1] : This is the point where everyone goes hiding behind the couch...
>> --
>> Science is always discovering odd scraps of magical wisdom and making a
>> tremendous fuss about its cleverness. (Aleister Crowley)
>
> Beware, that way lie patents.
>
Timothy Goddard, Can you explain what you mean by "Beware, that way lie
patents" please.
Cheers, Mike

Jano Svitok

10/6/2006 5:26:00 PM

0

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/0...)

- 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/0...)

J.

Wilson Bilkovich

10/6/2006 5:29:00 PM

0

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/0...)
>
> - 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/0...)
>

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.

David Vallner

10/6/2006 8:39:00 PM

0

Wilson Bilkovich wrote:
> That being said, there are some pretty cool parser generators for
> Ruby, so it could probably be done.
>

Doesn't the upcoming ANTLR support emitting Ruby code? You could try
that. I think there's also a project that tries to compile ASP.NET to
equivalent PHP using ANTLR, you could rip off^W^Wdraw inspiration from
their grammars.

David Vallner

Kevin Olemoh

10/7/2006 12:34:00 AM

0

Mike he was alluding to the closed source nature of Microsoft products
it was a joke.

F. Senault

10/7/2006 5:22:00 PM

0

Le 6 octobre 2006 à 22:39, David Vallner a écrit :

> Wilson Bilkovich wrote:
>> That being said, there are some pretty cool parser generators for
>> Ruby, so it could probably be done.
>
> Doesn't the upcoming ANTLR support emitting Ruby code?

Yep. Still in beta, though (both ANTLR 3 and the Ruby target part).

> You could try that. I think there's also a project that tries to compile
> ASP.NET to equivalent PHP using ANTLR, you could rip off^W^Wdraw
> inspiration from their grammars.

I think it's vastly different, alas. I'll wait for the ANTLR release
and try to write somthing on my own, but I'm afraid writing a whole
grammar is way over my competence... :|

Fred
--
I don't know who you are, But you seem very nice
So will you talk to me?
Shall I tell you a story, Shall I tell you a dream?
They think I'm crazy. (K's Choice, Everything for free)