vb6core
Shared type system and error model for the VB6 compiler and interpreter.
Overview
vb6core owns the foundational types that both vb6semantic (static analysis)
and vb6runtime (execution) depend on, so the whole toolchain agrees on one
type system:
- [
VBType] — the single source of truth for VB6 static types: primitives (Byte…Date), complex types (Class,UserType,Enum,Array), value states (Empty,Null,Nothing,Error), procedure types (Sub,Function), andUnknown. Includes VB6-exactVarTypecodes and widening rules. - [
TypeInfo] — wraps aVBTypewith the metadata static analysis needs:ByRefreferences, array bounds, and class names. - [
VBError] — runtime errors mirroring the VB6Errobject (number,description,source,help_file,help_context) plus the standard built-in error numbers and descriptions.
Keeping these types here ensures semantic analysis, code generation, and the
interpreter never drift apart (they previously lived in duplicated form in
vb6semantic and vb6runtime).
Architecture
┌──────────────────┐ ┌──────────────────┐
│ vb6interpret │ │ vb6compile │
└────────┬─────────┘ └────────┬─────────┘
│ │
┌────▼─────────┐ ┌─────▼─────────┐
│ vb6runtime │ │ vb6semantic │
└────┬─────────┘ └─────┬─────────┘
│ │
└─────────────┬───────────────┘
┌────▼──────┐
│ vb6core │ shared types + errors
└───────────┘
Usage
use ;
// Type codes and widening
assert_eq!;
assert!;
assert_eq!;
// Static metadata around a type
let mut info = new;
info.is_array = true;
assert_eq!;
// Runtime errors mirroring Err
use VBError;
let err = type_mismatch;
assert_eq!;
assert_eq!;
Dependencies
serde— serialization support for types shared across cratesinkwell(optional,llvmfeature) — reserved for the LLVM backend
vb6core is a leaf crate: it depends on no other vb6 project. vb6semantic
and vb6runtime both depend on it.
Testing
License
MIT License - see LICENSE file for details.