[English] PBXB64 V1 - The Native Multi-Frontend Compiler for Windows x64 (Alpha)

Started by Theo Gottwald, June 10, 2026, 12:19:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

PBXB64 V1 - The Native Multi-Frontend Compiler for Windows x64 (Alpha)
Five languages. One IR. One x64 backend. One PE32+. One Binary. ~856 KB.

---



Download: https://smart-ai-robot.com/compilers/pbxb64/ (8.9 MB ZIP, digitally signed)



What is PBXB64?

PBXB64 is a pure C17 compiler that translates five languages (B64, PowerBASIC, C, x64 assembly, PILOT) through a single IR pipeline and native x64 backend into real PE32+ Windows executables.

- No external toolchain - everything in one ~856 KB binary.
- Digitally signed - by Theo Gottwald, GlobalSign GCC R45

Born from the idea: Can you write a complete compiler backend (instruction selection, register allocation, peephole optimization, COFF emission, PE linking) in pure C17 - without relying on LLVM, GCC, or any other toolchain?

The answer is yes. In ~76 source files / ~43,000 lines of C.

---

Five Language Frontends

The unique thing about PBXB64: these are not five separate compilers bundled in one binary. It is one compiler with five frontends - all produce the same IR, run through the same optimizer, the same x64 backend, and the same PE linker.

LanguageExtensionStatusDescription
B64.b64ActiveC-like systems language with manual memory management, raw pointers, structs, function pointers, and globals. 13/13 link+run tests.
PowerBASIC.pb, .bas, .pbaActivePowerBASIC-compatible dialect: FUNCTION/SUB, LOCAL/GLOBAL, TYPE/UNION/ENUM, full FOR/NEXT semantics, PRINT, string builtins, file I/O. 20/20 link+run tests.
C17 Subset.c, .hActive#include, #define, #if/#endif, struct/union/typedef/enum, switch/case, function pointers, 33 C17 headers. 63/63 compile tests.
x64 ASM.asm, .sActiveIntel + AT&T syntax, direct COFF/PE emission without intermediate language.
PILOT.pilActiveEducational language: T:/A:/M:/Y:/N:/J:/U:/E: commands, conditional suffixes, pattern matching.

Mixed-Language Projects: PowerBASIC + inline ASM in the same module. B64 calls C functions. PILOT drives a BASIC program. The shared IR layer makes it all possible.

---

FOR/NEXT - Full Coverage

The long-standing "FOR-body constant-fold" bug is fixed. FOR/NEXT now works correctly for:

- 7 integer types: LONG, INTEGER, QUAD, DWORD, WORD, BYTE, CURRENCY
- 2 float types: SINGLE, DOUBLE (fully debugged as of Z62)
- Negative STEP: FOR i = 10 TO 1 STEP -1
- Nested loops: 2-deep, 3-deep, with dependent bounds (FOR j = 1 TO i)
- Float STEP: FOR f = 1.0 TO 3.0

FUNCTION PBMAIN() AS LONG
    LOCAL g AS LONG
    FOR i = 1 TO 3
        g = g + i
    NEXT
    FUNCTION = g         ' = 6
END FUNCTION

---

Technical Depth

ComponentSizeDetails
Lexer~3,000 LOCPer-language tokenizer
Parser~12,000 LOC5 language frontends with AST generation
IR Builder~2,000 LOCUnified Intermediate Representation
Optimizer~6,000 LOCPass manager, CFG, dominance, constant folding, DCE, copy propagation, peephole (9 passes), CSE, GVN, SCCP, LICM, SROA, strength reduction
x64 Backend~14,000 LOCInstruction selection, register allocation (graph coloring), peephole optimization, scheduler, frame layout, unwind info
Assembler~5,000 LOCx64 encoding, fixups, relocs, Intel + AT&T syntax
COFF Writer~1,500 LOCCOFF object file generation
PE Linker~3,000 LOCPE32+ image generation, import table, relocs, TLS, exception data (.pdata/.xdata)

Optimization passes (excerpt):
Constant Folding -> Dead Code Elimination -> Mem2Reg -> Copy Propagation -> CFG Cleanup -> Strength Reduction -> Instruction Combining -> Branch Simplification -> SCCP -> GVN -> DSE -> ADCE -> Reassociation -> Load Forwarding -> SROA -> LICM -> Peephole (9 passes)

---

Test Lane: 287/287 green, 0 expected fails

Every build runs through an automated test suite:

CategoryResultDescription
Assembly (-S)190/190Every .pb file compiles to .asm without errors
PB Link+Run20/20PB programs compile, link, and produce correct exit codes (FOR/NEXT, string ops, pointer/structs)
B64 Link+Run13/13B64 programs including calls, conditionals, loops, args, globals, division
C Compile (-S)63/63C programs with 33 C17 headers compile without errors
C Link+Run1/1C program runs and produces correct exit code

Build time: ~26 seconds (76 source files; incremental builds are much faster)

---

What's in the ZIP package? (8.9 MB)

- PBXB64.exe (~856 KB,packed, digitally signed by Theo Gottwald)
- PBXB64_Help.chm - Complete Windows help with command reference
- Includes/ - 1,233 PowerBASIC include files (.pbi) for Windows API, JSON, HTTP, OAuth, SMTP, COM, NetX, URI, JWT, etc.
- Samples/ - 127 example programs in 5 categories (asm, b64, basic, c, pb)
- README.md + SHA256.txt

---

Quick Start

PowerBASIC:
FUNCTION PBMAIN() AS LONG
    PRINT "Hello from PBXB64!"
    FUNCTION = 0
END FUNCTION

B64:
fn main(): i32 {
    let x: i32 = 42;
    return x;
}

C:
#include <stdio.h>
int main(void) {
    printf("Hello from PBXB64 C!\n");
    return 0;
}

Compile & Run:
PBXB64 my_program.pb -o my_program.exe
my_program.exe
echo %ERRORLEVEL%

Build from source (for developers):
cd corebuild.bat
build\PBXB64.exe --version
# -> PBXB64 version 0.50.0-z62

---

Alpha Notice

PBXB64 V1 is an Alpha release. Here is what that means:

What works (stable and tested):

- Five complete language frontends (B64, PB, C, ASM, PILOT)
- FOR/NEXT for all 7 integer types + 2 float types
- PRINT, string operations, file I/O
- B64: functions, parameters, globals, conditionals, loops
- C: #include, #define, struct/union/enum, switch/case, function pointers
- Assembler: Intel and AT&T syntax, COFF/PE
- PILOT: complete command set
- PE32+ linker: import tables, relocs, exception data
- 287 automated tests - all green, 0 expected failures
-packed and digitally signed

What is not yet complete:

- COM support (parser present, runtime stubs return default values)
- GUI/DIALOG/CONTROL (parser + IR present, runtime not fully implemented)
- C frontend: subset - not a full C17 hosted implementation (no libc library, no full preprocessor for all edge cases)
- No debugger - debugging is done via PRINT statements and exit codes
- Backwards compatibility with PowerBASIC: verified where tested, but complex WinAPI declarations may show differences

Who is PBXB64 V1 for?

- Developers looking for an all-in-one native x64 compiler
- PowerBASIC users porting projects to x64
- Language design enthusiasts interested in B64 or mixed-language projects
- Educational use (PILOT + BASIC + C in one compiler)

Who is it (not yet) for?

- Production environments requiring full COM/GUI support
- Users who need a debugger or IDE integration (CLI only)
- Projects that require a full C17 hosted libc implementation

---

Outlook: V2 and Beyond

Planned for upcoming versions:

- Debug information (DWARF) - so debuggers can work
- More complete C17 support - towards hosted libc
- Replace GUI/COM runtime stubs - dialogs, controls, graphics
- Backend performance optimizations
- Extended linker features

The compiler is designed as an open development platform. Feature suggestions, bug reports, and code contributions are welcome.

---



Download: https://smart-ai-robot.com/compilers/pbxb64/
8.9 MB ZIP - PBXB64.exe (856 KB) - PBXB64_Help.chm - 1233 Includes - 127 Samples



Theo Gottwald | Dettenheim, Germany | info@it-berater.org
Web: smart-ai-robot.com | Smart Package Robot



PBXB64 V1 - Z62 "FOR/NEXT Coverage" - 2026-06-10 - 287/287 tests green, 0 expected fails, 0 regressions.