PBXB64 supports a growing PowerBASIC-compatible dialect. V8 strengthens string lifetime management, PRINT semantics, and WinAPI integration.
Program Entry Point
FUNCTION PBMAIN() AS LONG ... END FUNCTION
FUNCTION PBMAIN() AS LONG
FUNCTION = 0 ' Return code
END FUNCTION
Variable Declarations
LOCAL x AS LONG ' Stack variable LOCAL s AS STRING ' Heap-managed string LOCAL f AS SINGLE ' 32-bit float DIM arr(10) AS LONG ' Static array (0-10) GLOBAL g AS LONG ' Module-level global
Assignment & Operators
x = 42 s = "Hello World" x = x + 1 y = a * b - c / d z = (x > 0) AND (y < 10)
PRINT Statement
PRINT expr [; expr] [, expr]
PRINT "Hello" PRINT "A"; "B" ' Semicolon: no separator PRINT "A", "B" ' Comma: tab stop (~8 chars) PRINT TAB(4); "D" ' TAB(n): pad with spaces
Control Flow
' IF/THEN/ELSE
IF x > 0 THEN
PRINT "positive"
ELSE
PRINT "negative"
END IF
' FOR/NEXT
FOR i = 1 TO 10 STEP 2
PRINT i
NEXT i
' WHILE/WEND
WHILE x < 100
x = x * 2
WEND
WinAPI Integration
#INCLUDE "windows_core.pbi"
FUNCTION PBMAIN() AS LONG
CALL MessageBoxA(0, "Hello", "PBXB64", 0)
CALL Sleep(1000)
FUNCTION = 0
END FUNCTION
String Operations (V7/V8)
LOCAL s AS STRING, t AS STRING s = "Hello" t = s + " World" ' Concatenation s = "" ' Reassignment frees old heap string automatically s = LEFT$(t, 5) ' Built-in string functions
String Lifetime Management: V7/V8 automatically frees heap-backed STRING values on reassignment, before RETURN, EXIT FUNCTION, and natural function exit. No manual STRFREE needed.
Known Limitations (V8)
VARPTRcurrently supported for arrays only (scalar VARPTR deferred)- Struct field access (
obj.field) not yet lowered in this pass &Hhex literals not yet supported- FULL PowerBASIC compatibility is ongoing work