Complete, compilable examples for each language frontend. All examples target Windows x64 PE32+ executables.
B64 - Hello World
fn main(): i32 {
return 42;
}
PBXB64 hello.b64 -o hello.exe
B64 - Pointers & Structs
struct Point { x: i32, y: i32 }
fn main(): i32 {
let p: Point = Point { x: 10, y: 20 };
let q: *Point = &p;
q.x = 30;
return q.x + q.y; // Returns 50
}
BASIC - Console Output
FUNCTION PBMAIN() AS LONG
PRINT "Hello from PBXB64!"
PRINT "Answer:"; 42
FUNCTION = 0
END FUNCTION
BASIC - WinAPI Integration
#INCLUDE "windows_core.pbi"
FUNCTION PBMAIN() AS LONG
CALL MessageBoxA(0, "Hello", "PBXB64", 0)
FUNCTION = 0
END FUNCTION
C - Standard I/O & Preprocessor
#include <stdio.h>
#define VERSION "V8"
int main(void) {
printf("Hello from C %s\n", VERSION);
return 0;
}
PBXB64 -I core/include/c17 -std=c17 program.c -o program.exe
C - Runtime Control Flow
int main(void) {
int x = 2;
switch (x) {
case 1: return 10;
case 2: return 20; // Falls through to default if break missing
default: return 0;
}
}
PILOT - Interactive Quiz
T: What is 2+2? A: M: 4 Y: Correct! Well done. N: Try again... E:
Mixed B64 + C Linking
// sum.c
int add(int a, int b) { return a + b; }
// main.b64
fn main(): i32 {
extern "sum.c" fn add(a: i32, b: i32): i32;
return add(10, 20); // Returns 30
}
PBXB64 main.b64 sum.c -o mixed.exe
Pro Tip: Use
--emit-ir or --emit-ast to debug compilation issues. Combine -v for verbose step-by-step output.