CompilerX64 - Compiler Werkstatt
Alpha Vorschau — Die Zukunft der Nativen Kompilierung

CompilerX64 ALPHA

Der Self-Hosting x86-64 Compiler der PowerBASIC Ersetzt

Imagine a compiler so powerful it compiles its own 203,000+ line source code. A compiler where you can override any built-in function with your own assembly. Where inline ASM speaks 561+ mnemonics spanning SSE4 to AVX-512 to Intel AMX. Where a 10-pass SSA optimizer with auto-vectorization transforms your BASIC into blazing native x64 machine code. This is CompilerX64.

Alpha — Download kommt bald
Download Coming Soon Help File (CHM) — Available Alpha Preview

203,000+ lines of compiler source

7-stage compilation pipeline

x64 PE32+ native output

Self-hosting target: in progress

7Stage pipeline: Lex → Parse → Sem → IR → CodeGen → Asm → Link
561+Unique mnemonics, 1,263+ encoder variants: GP, SSE, AVX, AVX-512, AES-NI, SHA, FMA3, CET, AMX
10Optimizer passes + SSA + Auto-vectorization (SIMD)
4Language frontends: BASIC, C, PILOT, ASM. One compiler, many faces

Why CompilerX64 Changes Everything

#OVERRIDE — Own the Compiler

Replace any built-in function with your own assembly. Not a wrapper. Not a hook. The compiler literally rewrites every call site to execute your machine code. Optimize strlen(), memcpy(), or anything else at the compiler level.

561+ Mnemonics — Future-Proof ASM

From basic MOV to AVX-512 masked operations to Intel AMX tile-based matrix math. Write inline assembly that targets the latest CPUs without external assemblers. Full encoder built-in.

SSA + Auto-Vectorization

A 10-pass optimizer converts your loops into SIMD vector code automatically. Static Single Assignment form, phi-node management, loop unrolling, function inlining, dead-code elimination, and constant folding — all built-in.

Self-Hosting — True Independence

CompilerX64 compiles itself. All 203K+ lines. No dependency on legacy 32-bit tools for the build. Own your entire toolchain from source to binary.

C Interop — Two Languages, One File

Drop C headers and C code directly into your BASIC source with #CINCLUDE and #CCODE. Mix BASIC's productivity with C's ecosystem. The preprocessor handles it all.

Variable Hooks — See Everything

#DEBUG VAR ON instruments every variable read and write with zero overhead when disabled. Build custom profilers, memory trackers, or security monitors without changing your code.

#OVERRIDE in Action

With #OVERRIDE, you replace the compiler's built-in with your own assembly — emitted inline at every call site. No function call. No stack frame. No prologue or epilogue. The compiler evaluates the arguments into registers, substitutes parameter names with those registers, and drops your raw ASM directly into the instruction stream.

Override a Built-in

#OVERRIDE LEN(s AS STRING) AS LONG ' s is substituted with the register holding the 1st param ' (RCX for STRING under Windows x64) mov rax, qword ptr [s+8] #END OVERRIDE FUNCTION PBMAIN() AS LONG ' Every LEN() call now emits YOUR ASM inline PRINT LEN("CompilerX64") FUNCTION = 0 END FUNCTION

The codegen replaces s with rcx and emits the instruction inline. No CALL, no RET, no stack frame.

What Happens Under the Hood

  • No function is created. The ASM body is stored as text and emitted inline at each call site.
  • Arguments are evaluated into Win64 registers (RCX, RDX, R8, R9) before your ASM runs.
  • Parameter names are substituted with their target register names at emit time.
  • Labels are uniquified per call site so multiple calls never collide.
  • No CALL/RET overhead. Your code lives directly in the caller's instruction stream.
  • Supports up to 8 parameters with BYVAL/BYREF.
ParamInteger/PtrFloat
1stRCXXMM0
2ndRDXXMM1
3rdR8XMM2
4thR9XMM3
5th+Stack
ReturnRAXXMM0

Type families: BYTE, WORD, LONG, QUAD, SINGLE, DOUBLE, STRING, PTR.

Architecture — From Source to Silicon

Source (.bas / .c / .pil / .asm) |-> Preprocessor (20+ directives: #IF, #INCLUDE, MACRO, #OVERRIDE, #GLOBAL) |-> Lexer (language-aware tokenization) |-> Parser (AST construction via canonical Pipeline API) |-> Semantic Analysis (type checking, flow analysis, symbol binding) |-> IR Generation (unified intermediate representation) |-> Optimizer (10 passes, SSA conversion, auto-vectorization) |-> x64 CodeGen (instruction selection, register allocation) |-> Assembler (561+ mnemonics, x64 encoding, COFF output) |-> Linker (PE32+ image, imports, exports, relocations)

Quick Example

#COMPILE EXE "hello.exe" #DIM ALL FUNCTION PBMAIN() AS LONG PRINT "Hello from CompilerX64!" FUNCTION = 0 END FUNCTION
cx64 hello.bas -o hello.exe hello.exe Hello from CompilerX64!

C Interop + Inline ASM

Mixed BASIC + C

#CINCLUDE "math.h" #CCODE int add(int a, int b) { return a + b; } #ENDCCODE FUNCTION PBMAIN() AS LONG PRINT "2 + 3 = "; add(2, 3) FUNCTION = 0 END FUNCTION

Inline ASM With PB Symbols

FUNCTION AddOne(BYVAL x AS LONG) AS LONG #ASM mov eax, x ' compiler binds PB variable x to the right register inc eax #ENDASM END FUNCTION

Inline ASM blocks bind directly to PB symbols — use your variable names, not raw registers. The compiler resolves each symbol to its current stack slot or register assignment.

Preprocessor — 20+ Directives

The preprocessor is not an afterthought. It is a full macro engine with conditional compilation, code hoisting, and C-style pragma support that runs before a single token is parsed.

DirectiveWhat It Does
#DEFINE / #UNDEFText macros and compile-time constants with full expression support
#IFDEF / #IFNDEF / #ELSE / #ENDIFConditional compilation based on macro or equate definition
#INCLUDE / #INCLUDE ONCERecursive file inclusion with circular-detection and duplicate guards
#COMPILE EXE / #COMPILE DLLSpecify output type, filename, and entry point
#DIM ALL / #DIM NONEEnforce or relax explicit variable declarations
#OPTIONSet compiler options: ANSIAPI, VERSION5
#REGISTERRegister allocation hints: ALL, DEFAULT, NONE (per-routine or global)
#RESOURCEEmbed icons, manifests, version info, and custom resources into the PE
#GLOBAL / #GLOBALHEREHoist code blocks to global scope from anywhere in the source tree
#MAINHEREHoist initialization code directly into PBMAIN from any file
#UNIQUEGenerate unique identifiers to avoid name collisions in generated code
#pragmaC-style pragmas: once, pack(push/pop), comment(lib), message
MACRO / MACROFUNCTIONMulti-line text macros and function-like macros with parameter substitution
#OVERRIDEReplace built-in functions with custom assembly at the compiler level
#CCODE / #CINCLUDEEmbed C code or include C headers directly inside BASIC source
#ASM / #ENDASMInline assembly blocks with full access to PB variables and symbols

MODULE System — Industrial-Scale Organization

CompilerX64 implements a modern module system that goes far beyond simple source files. Organize large projects with explicit boundaries, initialization guarantees, and interface contracts.

MODULE / END MODULE

MODULE MathLib PRIVATE FUNCTION InternalCalc(BYVAL x AS LONG) AS LONG FUNCTION = x * 2 END FUNCTION PUBLIC FUNCTION DoubleIt(BYVAL x AS LONG) AS LONG FUNCTION = InternalCalc(x) END FUNCTION END MODULE

MODULE blocks create scoped namespaces. PRIVATE members are invisible outside; PUBLIC members are the module's API.

MODULE INIT / MODULE TERM

MODULE INIT ' Runs automatically before PBMAIN CALL InitializeGlobals() END MODULE INIT MODULE TERM ' Runs automatically on exit CALL CleanupResources() END MODULE TERM

Guaranteed initialization and cleanup. MODULE INIT runs before your program starts. MODULE TERM runs in reverse order before exit.

FeatureDescription
MODULE ... END MODULEScoped namespace with PRIVATE and PUBLIC visibility controls
MODULE INITAutomatic initialization block executed before PBMAIN
MODULE TERMAutomatic cleanup block executed on program termination
MODULE INTERFACEDeclare a contract (API) without implementation
MODULE IMPLEMENTSProvide the implementation for a declared interface
IMPORT / EXPORTExplicit cross-module symbol visibility

x64 Assembler — 561+ Unique Mnemonics, 1,263+ Variants

The built-in assembler is a production-grade x64 encoder with 561 unique mnemonics and 1,263+ encoder function variants covering register-to-register, register-to-memory, immediate, RIP-relative, SIB, and masked operations. No external assembler required. Everything from basic MOV to Intel AMX tile-based matrix math is encoded directly to COFF.

GPGeneral-purpose: MOV, ADD, SUB, MUL, DIV, CMP, Jcc, CALL, RET, LEA, PUSH, POP, and more
SSESSE through SSE4.2: MOVAPS, ADDPS, MULPS, CMPccPS, SHUFPS, BLENDPS, and full integer support
AVXAVX, AVX2, AVX-512: VADDPS, VFMA, VBROADCAST, VPERM, masked operations with k-registers
CryptoAES-NI, SHA, PCLMULQDQ, FMA3 fused multiply-add, CET control-flow enforcement
CategoryInstructionsUse Case
Data MovementMOV, MOVSX, MOVZX, LEA, PUSH, POP, XCHG, CMPXCHGRegisters, memory, stack operations
ArithmeticADD, ADC, SUB, SBB, INC, DEC, NEG, CMP, MUL, IMUL, DIV, IDIVInteger math with full 64-bit precision
Logical / ShiftAND, OR, XOR, NOT, TEST, SHL, SHR, SAR, ROL, ROR, RCL, RCR, SHLD, SHRDBit manipulation and rotation
Control FlowJMP, JE, JNE, JA, JAE, JB, JBE, JG, JGE, JL, JLE, CALL, RET, LOOPBranches, loops, procedure calls
SSEADDPS, MULPS, DIVPS, SQRTPS, MINPS, MAXPS, CMPPS, ANDPS, ORPS, XORPS, MOVAPS, MOVLPS, MOVHPS, SHUFPS, UNPCKLPS128-bit floating-point vectors
SSE2 IntegerPADDB, PADDW, PADDD, PADDQ, PCMPEQB, PCMPGTB, PAND, POR, PXOR, PSLLW, PSRLD, PSHUFD128-bit integer vectors
AVX / AVX2VADDPS, VSUBPS, VMULPS, VDIVPS, VFMADD, VBROADCASTSS, VPERM, VSHUFPS, VPADDB, VPMULLW256-bit vectors with 3-operand syntax
AVX-512VADDPS (zmm), VPADDQ, VFMADD231, masked ops (k1), VBROADCASTF32x8, VPERMT2D512-bit vectors, mask registers, tile ops
AES-NIAESENC, AESENCLAST, AESDEC, AESDECLAST, AESIMC, AESKEYGENASSISTHardware-accelerated encryption
SHASHA1RNDS4, SHA1NEXTE, SHA256RNDS2, SHA256MSG1, SHA256MSG2Hardware-accelerated hashing
FMA3VFMADD132PS, VFMADD213PS, VFMADD231PS, VFMSUB..., VFNMADD...Fused multiply-add for high-precision math
CETENDBR64, INCSSP, RDSSP, SAVEPREVSSPControl-flow enforcement and shadow stack
AMXLDTILECFG, STTILECFG, TILELOADD, TILESTORED, TILEZERO, TDPBF16PS, TDPBSSDTile-based matrix multiplication (Intel AMX)

Full 646-line assembler guide with encoding details, ModR/M/SIB byte structures, prefix reference, and CPUID feature detection tables included in the documentation.

Optimizer Passes — Ten Layers of Speed

PhasePassDescription
Phase 1: BasicOPT-001Dead Code Elimination
OPT-002Constant Propagation & Folding
OPT-006Loop Unrolling (2x, 4x, 8x)
Phase 2: AdvancedOPT-003LICM — Loop-Invariant Code Motion
OPT-004Memory-to-Register Promotion
OPT-005Function Inlining
Phase 3: FoundationOPT-F1SSA Conversion
OPT-F1bPhi Node Management
OPT-F1cSSA Destruction
OPT-F2Auto-Vectorization (SIMD)

Development Status

ComponentStatusNotes
Lexer / Parser~95%Canonical Pipeline API declared; legacy parsers retired
Semantic Analysis~90%Type checking, flow analysis, loop context validation
IR Generation~85%Infrastructure complete, unified representation
Code Generation~85%PRINT exact-output working, signed comparisons active
Optimizer100%10 passes, SSA, vectorization all implemented
Assembler~90%x64 encoding, COFF output working
Linker~85%PE32+ generation, imports, exports, relocations
Runtime~80%Canonical C-based runtime, console I/O, file I/O
Self-HostingIn ProgressStage1 verification active; AST pool, loop control fixed

Alpha Preview

CompilerX64 is currently in active development. The download package will include the compiler executable, the CX64Editor IDE, WinAPI includes, and full documentation. Stay tuned for the first public alpha release.

Business & Source Code License

For companies that need full control over their toolchain, the complete CompilerX64 source code is available for purchase. This includes the entire compiler codebase, the CX64Editor IDE, runtime libraries, and build scripts.

  • Build your own custom compiler with private extensions
  • Modify the language, add new directives, or tune the optimizer
  • Guaranteed long-term availability — no dependency on third-party tools
  • Full source access to the 203K+ line compiler, editor, and runtime
  • Use your own tools, maintain your own builds, protect your IP
$1,999

One-time purchase
Full source code + Editor

Contact: info@it-berater.org