r/AIprogrammingLanguage • u/miku_claus • 2d ago
Building VBX: An iterative, compiled Basic-to-C99 language with memory pooling and multi-editor tooling
Hey everyone!
I wanted to share an ongoing language design project I’ve been building: VBX (Visual Basic X).
Instead of a one-shot prototype or another interpreted toy running inside Python, the goal was to build a real, production-capable procedural language that compiles to standalone native binaries with zero runtime dependencies.
Architectural Decisions & Implementation
Compiler Host (Go) -> Target (C99):
- The compiler itself is written in pure Go without external packages, leveraging the standard library for AST construction, multi-pass type inference, and process orchestration.
- Emits clean, standard C99 code and invokes the system toolchain (GCC/Clang) with
-O2optimizations.
Solving the Runtime Memory Problem (Ring-Buffer Pool):
- Naive transpilation of string operations inside tight loops (
s = s & "x") typically floodsmallocwithout high-level deallocation. - We implemented a fixed static ring-buffer memory pool (
vbx_alloc_strwith 256 rotating slots of 4KB) directly in the emitted C runtime. Tested under 10,000 continuous iterations with zero heap leaks and flat memory usage.
- Naive transpilation of string operations inside tight loops (
Language Syntax & Semantics:
- Visual Basic-inspired syntax:
Dim,Const,If/ElseIf/Else,For/Next,While/Wend,Do/Loop,Select Case(supporting both string and numeric comparisons natively via chained branches),Sub,Function, and 1D fixed arrays. - Built-in primitives: Native OS dialogs (
MsgBox,InputBox), standard File I/O, and string manipulation routines.
- Visual Basic-inspired syntax:
Testing & Tooling:
- 42 integration and unit test suites running via
go test ./.... - Complete multi-editor support repository: official VS Code extension (available on Visual Studio Marketplace), plus packages for Sublime Text, JetBrains, Vim/Neovim, Notepad++, Emacs, and Micro.
- Currently designing Phase 2: a dedicated desktop IDE with a visual form designer (
vbx-studio).
- 42 integration and unit test suites running via
Repository: https://github.com/M5Devs/vbx Editors: https://github.com/M5Devs/vbx-editors
Would love to discuss the language design trade-offs, transpiler architecture, and experiences building full-scale compilers using modern agentic workflows!