Java Parser for VB (Visual Basic)

What is VBParser?

VBParser is a Java-compatible parser for the VB (Visual Basic) language. It has been developed using JavaCC.

Do I Need to Know About JavaCC to Use the Parser?

Not if you don't want to, the generated classes are all in vbparser.jar. However if you want to learn more about JavaCC please see its FAQ.

What Does VBParser Do?

VBParser analyzes a VB program, generating a Parse Tree for it. The Parse Tree could then be used to:

What Does VBParser Not Do?

VBParser does not execute the code it parses, and it does not generate a compiled file. A parser is just the front-end of a compiler, and a code generator / run-time interpreter would be needed for execution. Writing a code generator is a big job! You may want to have a look at MiniJava for an example of a code generator using JavaCC and BCL.

The Source Code

The source code is included in the download ZIP file. The parser is in VBParser.jjt, and there is a test program TestParser.java. make.bat is a sample makefile -- you will need to customise directory names etc.

The file VBErrHandlerVisitor.java demonstrates how the parser might be used.

I plan to make improvements to this documentation over the next few months; in the mean time please contact me if you have any questions.