-
released this
2026-02-06 20:26:19 +00:00 | 13 commits to main since this release⚠️ IMPORTANT
To make it work, you MUST run
setup.batas Administrator!🚀 v0.0.3-beta - Modular Architecture & x64 Assembly Overhaul
This major update transforms PCC from a simple calculator/interpreter into a true native compiler that generates optimized x64 assembly code.
✨ New Features
- Function Arguments & Returns: Complete support for passing parameters (e.g.,
int add(int a, int b)) and returning values usingreturn. - Local Scope & Stack Memory: Variables are now allocated on the stack (
[rbp-offset]) instead of global maps, enabling true function scope. - Runtime Evaluation: Math expressions (
+,-,==) are now translated to Assembly instructions (ADD,CMP,SETE) and executed by the CPU, not pre-calculated by the compiler. - Interactive I/O: Added
input()function (wrapping standardgetchar) to pause execution and accept user input. - Improved Boolean Logic:
ifstatements now correctly handle comparisons (==) using jump instructions (JMP,JZ).
🛠 Architecture & Refactoring
- Modular Codebase: Split the monolithic source code into distinct modules:
parser.cpp(Syntax analysis)codegen.cpp(Assembly generation)utils.cpp(String helpers)
- Intermediate Representation (IR): Replaced direct execution with an
Instructionstruct system, decoupling parsing from code generation. - x64 Convention: Implemented Windows x64 calling convention elements (using
RCX,RDXfor argument passing).
🐛 Bug Fixes
- Parser Ambiguity: Fixed issues where variable declarations with assignments (
int a = b) were sometimes mistaken for function definitions. - Operand Size Mismatch: Fixed NASM errors by implementing
movsxdfor proper 32-bit to 64-bit integer promotion. - Label Redefinition: Fixed logic for generating unique jump labels (
L_1,L_2) in control flow statements.
📦 How to use:
- Download the latest release from the Realeases page.
- Unzip the archive to C:/PCC/
- Run
setup.batas Administrator. - Compile your code:
PCC.exe code.pcc.
Downloads
- Function Arguments & Returns: Complete support for passing parameters (e.g.,