tags:

views:

1395

answers:

7

I've done a fair bit of googling, but I've been unable to find what I'm looking for. I am looking for documentation of the syntax to the Visual Basic 6.0 language. Specifically something that could theoretically be used to build a parser for the syntax. Does anyone know of such documentation?

+7  A: 

Visual Basic 6.0 Language Reference

Jesse
This is a good reference as far as what is in the global namespace (functions, methods, objects, etc) and definition for various keywords in the language that is useful for people writing code in the language, but it is far from a syntax definition that could be used as a reference for creating a language parser.
Mark Roddy
I agree...from what I saw on the web though it is likely your best bet. Using it you could piece together a grammar as one of the other answers mentioned.
Jesse
@Jesse your probably right that this is my only choice, but I was hoping someone could offer a better reference than what is on the MSDN site (or an alternative section of MSDN I did not come across, would not have surprised me considering how unintuitive that site is).
Mark Roddy
+1  A: 

There is some information in the VB documentation, but it isn't really a grammar. We had to build one from scratch for our VB6 parser. http://www.semdesigns.com/Products/FrontEnds

Ira Baxter
Obviously a long shot since it's from a company, but any chance you could release the documentation on the language syntax? I'm not looking for code, just documentation on the grammar.
Mark Roddy
This sounds like an offline discussion. I'm easily found on the web.
Ira Baxter
Thanks, will contact you via email.
Mark Roddy
A: 

I would start with the Visual Basic Reference from MSDN. I don't see a formal grammar specification, but it might be in there somewhere.

Greg Hewgill
Thanks. I've been through there pretty thoroughly and there isn't a specific language grammar reference. Go figure that Microsoft doesn't want to make it easy for other people to make their own compiler for their language :-)
Mark Roddy
I think it's more that Microsoft just doesn't care. To begin with they've left classic VB to die by the side of the road as they move on with other things. As far as the "language" itself though you could probably go back as far as QBasic/QuickBasic and have a good 1st approximation of VB6... or even look at VBScript. The reason there is no good VB6 clone though is there is a lot more to VB6 than a language. Most of it is shaped by other things like the COM subset VB6 uses, the standard Forms and Controls, data binding, event handling, etc.
Bob Riemersma
+1  A: 

To take another stab at this based on a comment I left elsewhere, I found a grammar for VBScript on the Web you might at least take a look at.

This is about as close as I have seen to a formal grammar for VB6 though of course it isn't for VB6 at all.

I'm sure from comments within it there are a few issues, and of course VBScript is missing things like strong typing and statement labels and differs from VB6 in a number of other ways. It also isn't "official" in any way. You might still find it at least somewhat useful however.

Go to C# GOLD Parser Engine and scroll to the bottom of the page for the ZIP download containing this guy's VBScript grammar in BNF.

Bob Riemersma
+1  A: 

While not VB6 I would look through the VB section of the Mono Project and the stuff that FreeBasic People are going. Of the two FreeBasic is the closer as VB.NET add a lot of syntax while the QuickBASIC syntax that FreeBASIC uses is the progenitor of VB6.

You have to remember that VB6 is problematical to parse because of the extra information inserted in the form and classes. They are not part of the language exactly but rather used by the IDE when compiling a VB6 program. Nobody I know has created a grammar for this. Although it is a fairly simple structure.

Mono VB FreeBASIC

RS Conley
+1. Although I think your links have got a bit mangled? The mono entry links to FreeBasic. I would also add that the form file format is partially documented in the Vb6 manual http://msdn.microsoft.com/en-us/library/aa733725(VS.60).aspx
MarkJ
A: 

The VBA language specification is online on MSDN. It must be 99% equivalent to VB6.

MarkJ
A: 

VB6 has a couple of file formats: forms, classes, modules, frx-files. There's a lot of grammars. I don't think someone ever tried to write them out.

Anthrax Gamma
Ew, FRX files (aka form resource stashes).There are also some directives in the language proper that aren't visible in the IDE; this can trip you up if you aren't careful.
Jeffrey Hantin