OK, it took a while, but my updated version of the VBParser source code sample is finally up! Since the 7.1 version of VBParser ended up being essentially a read-only project on GotDotNet, I’ve decided to eschew GDN and just go with a straight source download. I’ve added a new set of links on the left hand side of my blog entitled “Samples,” and put both the 7.1 and 8.0 version of VBParser there.
Things that are new or changed in VBParser 8.0:
- I’ve updated the source to take advantage of VB 8.0 features such as generics, IsNot, etc. Because of this, VBParser 8.0 is not API compatible with VBParser 7.1. Any code that’s built with VBParser 7.1 will need to be updated, but it shouldn’t be too painful of a task.
- As the name implies, VBParser 8.0 should parse all of the new VB 8.0 features. There is also a 7.1 compatibility mode that you can use to parse VB 7.1 code (which is a strict subset of VB 8.0).
- This is a sample that I wrote on my own, which means that the only testing that it got was the testing that I did on my own. As such, there are no guarantees made of completeness, correctness or suitability for any particular purpose. I did try my best to make sure that it works well, but you should consider the sample as being in permanent beta. There may be stupid bugs still lurking in the source.
- Please drop me a line with any and all bugs that you find and I’ll be happy to take a look at them and fix them as time permits. If you end up using VBParser for something, let me know!
You can get VBParser 8.0 here. [07/12/2014: The sources for VBParser 8.0 are now on GitHub.] You can get VBParser 7.1 (the previous version) here. [07/12/2014: The sources for VBParser 7.1 are now on GitHub.] Hope people find it useful!
i just stambled upon this blog, and being a VB expert myself i was curious. however, in your post there is really no info what this thing is or does. there is also no link to the previous blog where maybe there is info. maybe you can add something.
Leo: If you check out the "Samples" category to the left, you’ll see all the posts on the VBParser samples. It’s true at this point that there isn’t much documentation, I’d like to see more for it in the future, maybe I’ll be able to write some blog entries on it…
Very interesting. I have been working on a similar pet project in my spare time for a couple of years now. The parsing capability I have developed is designed for languages in general rather than for a specific language such as VB. The grammar (rules of the language as you might find them defined in a reference manual) are defined in a text file using a slightly modified version of EBNF notation. These rules are parsed, validated and stored in a structured database form to simplified use during parsing of source code programs. During parsing of a program the grammar rules are applied to the source code and program tokens are separated, classified and stored in a repository for subsequent simplified processing. Figuring out how to recover from false positive matches was a real killer. Thus far I have successfully parsed hundreds of large (15000+ lines of code) real life COBOL programs, JCL, SQL and some other embedded languages. I’m wrapping up work on JCL at the moment (whenever I can find spare time which isn’t very frequently). I’m pretty sure the intrinsic capabilities of the parser could handle VB if I had the time to define the VB grammar rules in EBNF.
Anyway, all of the above isn’t worth a cup of coffe if you dojn’t somehow take advantage of the results produced by the parser. I hope one day before I pass on I’ll have the time to develop a tool to use them 🙂
It’s really cool to see somebody who shares my interest in parsing and potentially related tools. I have no idea how I got this addiction 🙂 If you ever want to chat you can reach me at firstname.lastname@example.org
Shouldn’t it be VbParser?
I’ve found a couple of untested comment and blank line scenarios (again). The differences are here:
The full archive is here:
The full archive includes indentation changes and one tentative extra error. It’s a semantic error, and I haven’t confirmed it to be true in general, but I believe a UnaryExpression cannot be a standalone statement. It’s only an Assert at the moment.
I missed actually stating the changes include fixes for the comment and blank line scenarios that failed with the original code.
My journey to VBParser:
🙂 I got the task to upgrade code from VB6 to VB.Net. After the Upgrade-Wizard has worked there are many things to do in the sourcecode.
🙂 With the VS2005, I can use the best developing IDE in the world, with thousands of ready made classes.
🙂 With the VS Automation Model (Object DTE) I can do the parsing job.
😐 But, where are the codemodel for the body from Sub/Function/Property?
🙁 It is definitely missing.
😐 Ok, I must use system. CodeDom instead. Hmm … .Parse is abstract.
🙂 For sure, I must use the language specific implementation in VbCodeProvider…Parse
🙁 It’s an empty implementation.
😐 Searching the web.
😐 Continued… Found such important products like "Visual Parse" with the headline ".NET Support is here". The latest version is six years old.
😐 Perhaps I should build a parser by my one. How long can it takes?
😐 There is support in "GOLD Parser" to get the tokens from VB source
🙂 I found VBParser.
🙂 I test it, great!
Thank you for distribution and maintain.
Pingback: Li Chen's Weblog
I’m looking forward for VBParser 6.0… for real VB programming with VB Classic. It would be nice if there was some kind of wizard to downgrade VB.not to VB6!