← VB6 Workspace

VB6Parse

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

starting to parse

Documentation 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

🛡️ 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

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.

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.