VB6Parse

A complete, high-performance parser library for Visual Basic 6 code and project files

Overview

VB6Parse is designed as a foundational library for tools that analyze, convert, or process Visual Basic 6 code. While capable of supporting real-time syntax highlighting and language servers, its primary focus is on offline analysis, legacy code utilities, and migration tools.

Key Features

🚀 High Performance

Fast, efficient parsing with minimal allocations and zero-copy tokenization

📦 Full VB6 Support

Supports projects (.vbp), modules (.bas), classes (.cls), forms (.frm), and resources (.frx)

🌲 Concrete Syntax Tree

Complete source fidelity with CST preserving all whitespace and comments

📚 VB6 Library

160+ built-in VB6 library functions and 42 statements documented

🛡️ Error Handling

Comprehensive error handling with detailed failure information and recovery

✅ Well Tested

5,500+ tests including unit tests, integration tests, doc tests, and fuzz testing

Quick Start

👉 New to VB6Parse?

Follow our comprehensive Getting Started guide for step-by-step tutorials, error handling, and real-world examples.

View Getting Started Guide →

Architecture

VB6Parse uses a seven-layer parsing pipeline that transforms raw bytes into structured VB6 objects. Each layer builds on the previous one, providing clean separation of concerns and allowing you to hook into the parsing process at any level.

I/O Layer
Bytes/String/File
SourceFile
(Windows-1252)
SourceStream
(Characters)
Lexer Layer
TokenStream
(Tokens)
Parser Layer
CST
(Syntax Tree)
VB6 Language Layer
VB6 Objects
(ProjectFile, ClassFile, ModuleFile, FormFile, etc.)
Controls
(50+ control types)
Colors
(24 predefined)

Layer Details

I/O Layer

Input: Raw bytes, strings, or files

Output: Character streams

Purpose: Handles Windows-1252 encoding and provides character-level access to source code.

Key Types: SourceFile, SourceStream

Lexer Layer

Input: Character stream

Output: Token stream

Purpose: Converts characters into tokens (keywords, identifiers, operators, literals).

Key Types: TokenStream, Token

Parser Layer

Input: Token stream

Output: Concrete Syntax Tree (CST)

Purpose: Builds a complete tree structure preserving all source information.

Key Types: ConcreteSyntaxTree, CstNode

VB6 Language Layer

Input: Source files

Output: Structured file objects

Purpose: High-level parsers for each VB6 file type.

Key Types: ProjectFile, ClassFile, ModuleFile, FormFile

💡 Flexibility by Design: You can use VB6Parse at any layer depending on your needs. Need just tokens? Use the Lexer. Need full file parsing? Use the Files layer. Want to build custom analysis tools? Navigate the CST directly. Each layer is independently useful.

Supported File Types

Extension Description Status
.vbp Project files ✅ Complete
.cls Class modules ✅ Complete
.bas Code modules ✅ Complete
.frm Forms ⚠️ Partial
.frx Form resources ⚠️ Partial
.ctl User controls ✅ Parsed as forms
.dob User documents ✅ Parsed as forms

Testing & Quality

Test statistics being generated...

VB6Parse uses comprehensive testing including unit tests, snapshot testing with insta, benchmarking with criterion, and fuzz testing with cargo-fuzz.

Community & Contributing

VB6Parse is open source and welcomes contributions! Whether you're reporting bugs, suggesting features, or submitting pull requests, your help is appreciated.