Track the development progress of the Baa programming language. **Current Status:** Phase 4.5 - Reference Compiler Stabilization (v0.5.x) ← IN PROGRESS
---
Goal: Produce a Kernighan & Ritchie–style first book for Baa, in Arabic, serving as the definitive learning + reference resource.
- [~] Write the Arabic "Baa Book" — book-length guide in Arabic with exercises. — draft exists in
docs/BAA\_BOOK\_AR.md - Define terminology glossary —
docs/TERMINOLOGY_GLOSSARY.mdis the canonical Arabic/English vocabulary source. - Create example suite — verified, idiomatic examples that compile with v0.3.7.
- Add exercises and challenges — per chapter, with expected outputs.
- Add debugging and performance chapters — common pitfalls, diagnostics, optimization notes.
- Native technical review — review by Arabic-speaking engineers before release.
---
Goal: Decouple the language from x86 Assembly to enable optimizations and multiple backends.
**Design Document:** See [BAA_IR_SPECIFICATION.md](docs/BAA_IR_SPECIFICATION.md) for full IR specification.
- Define
IROpenum — All opcodes:IR\_OP\_ADD,IR\_OP\_SUB,IR\_OP\_MUL, etc. - Define
IRTypeenum — Types:IR\_TYPE\_I64,IR\_TYPE\_I32,IR\_TYPE\_I8,IR\_TYPE\_I1,IR\_TYPE\_PTR. - Define
IRInststruct — Instruction with opcode, type, dest register, operands. - Define
IRBlockstruct — Basic block with label, instruction list, successors. - Define
IRFuncstruct — Function with name, return type, entry block, register counter. - Create
ir.h— Header file with all IR definitions. - Create
ir.c— Implementation with helper functions and IR printing.
-
IRBuildercontext struct — Builder pattern with insertion point tracking. -
ir\_builder\_create\_func()— Create a new IR function. -
ir\_builder\_create\_block()— Create a new basic block with label. -
ir\_builder\_set\_insert\_point()— Set insertion point for new instructions. -
ir\_builder\_alloc\_reg()— Allocate next virtual register%م<n>. -
ir\_builder\_emit\_\*()— Emit instructions (add, sub, mul, div, load, store, br, ret, call, etc.). - Control flow helpers —
ir\_builder\_create\_if\_then(),ir\_builder\_create\_while(). - Create
ir\_builder.h— Header file with builder API. - Create
ir\_builder.c— Implementation of builder functions.
-
lower\_expr()— Main expression lowering dispatcher. - Lower
NODE\_INT— Return immediate value. - Lower
NODE\_VAR\_REF— Generateحمل(load) instruction. - Lower
NODE\_BIN\_OP— Generateجمع/طرح/ضرب/قسمinstructions. - Lower
NODE\_UNARY\_OP— Generateسالب/نفيinstructions. - Lower
NODE\_CALL\_EXPR— Generateنداء(call) instruction.
-
lower\_stmt()— Main statement lowering dispatcher. - Lower
NODE\_VAR\_DECL— Generateحجز(alloca) +خزن(store). - Lower
NODE\_ASSIGN— Generateخزن(store) instruction. - Lower
NODE\_RETURN— Generateرجوع(return) instruction. - Lower
NODE\_PRINT— Generateنداء @اطبع()call. - Lower
NODE\_READ— Generateنداء @اقرأ()call.
- Lower
NODE\_IF— Create condition block + true/false blocks + merge block. - Lower
NODE\_WHILE— Create header/body/exit blocks with back edge. - Lower
NODE\_FOR— Create init/header/body/increment/exit blocks. - Lower
NODE\_SWITCH— Create comparison chain + case blocks. - Lower
NODE\_BREAK— Generateقفزto loop exit. - Lower
NODE\_CONTINUE— Generateقفزto loop header/increment.
-
ir\_print\_func()— Print function header and all blocks. -
ir\_print\_block()— Print block label and all instructions. -
ir\_print\_inst()— Print single instruction with Arabic opcodes. - Arabic numeral output — Print register numbers in Arabic (٠١٢٣٤٥٦٧٨٩).
-
--dump-irCLI flag — Add command-line option to print IR.
- Integrate IR into pipeline — AST → IR (skip direct codegen).
- Create
ir\_test.baa— Simple test programs. - Verify IR output — Check IR text matches specification.
- Update
main.c— Add IR phase between analysis and codegen. - Add
--emit-irflag — Write IR to.irfile. - Fix global variable resolution — Proper lookup in
lower\_expr()andlower\_assign().
---
- CFG validation — Verify all blocks have terminators.
- Predecessor lists — Build predecessor list for each block.
- Dominator tree — Compute dominance relationships.
- Define
IRPassinterface — Function pointer for optimization passes.
- Detect constant operands — Both operands are immediate values.
- Fold arithmetic —
جمع ص٦٤ ٥، ٣→٨. - Fold comparisons —
قارن أكبر ص٦٤ ١٠، ٥→صواب. - Replace instruction — Remove op, use constant result.
- Mark used values — Walk from terminators backward.
- Identify dead instructions — Result never used.
- Remove dead instructions — Delete from block.
- Remove unreachable blocks — No predecessors (except entry).
- Detect copy instructions —
IR\_OP\_COPY(نسخ) instruction pattern. - Replace uses — Substitute original for copy in operands / call args / phi entries.
- Remove redundant copies — Delete
نسخinstruction after propagation.
- Hash expressions — Create signature for each operation.
- Detect duplicates — Same op + same operands.
- Replace with existing result — Reuse previous computation.
- Pass ordering — Define optimal pass sequence (constfold → copyprop → CSE → DCE).
- Iteration — Run passes until no changes (fixpoint, max 10 iterations).
-
-O0,-O1,-O2flags — Control optimization level. -
--dump-ir-opt— Print IR after optimization.
---
- Define
MachineInst— Abstract machine instruction. - IR to Machine mapping —
جمع→ADD,حمل→MOV, etc. - Pattern matching — Select optimal instruction sequences.
- Handle immediates — Inline constants where possible.
- Liveness analysis — Compute live ranges for each virtual register.
- Linear scan allocator — Simple, fast allocation algorithm.
- Spilling — Handle register pressure by spilling to stack.
- Map to x64 registers — RAX, RBX, RCX, RDX, R8-R15.
- Emit function prologue — Stack setup, callee-saved registers.
- Emit instructions — Generate AT&T syntax assembly.
- Emit function epilogue — Stack teardown, return.
- Emit data section — Global variables and string literals.
- Replace old codegen — IR → Backend → Assembly.
- Verify output — Compare with old codegen results.
- Performance testing — Ensure no regression.
- Remove legacy codegen — Retire the legacy AST backend from the build.
- Fix ISel logical op size mismatch —
isel\_lower\_logical()forced 64-bit operand size; widened 8-bit boolean vregs to prevent assembler errors. - Fix function parameter ABI copies —
isel\_lower\_func()prepends MOV from RCX/RDX/R8/R9 to parameter vregs at entry block. - Fix IDIV RAX constraint —
isel\_lower\_div()explicitly routes dividend through RAX (vreg -2) for correct division results. - Comprehensive backend test —
tests/integration/backend/backend\_test.baa: 27 functions, 63 assertions, all PASS.
- Bundle MinGW-w64 GCC — Ship GCC toolchain in
gcc/subfolder inside the installer. - Auto-detect bundled GCC —
resolve\_gcc\_path()inmain.cfindsgcc.exerelative tobaa.exe. - Update installer (setup.iss) — Add
gcc\\\*files, dual PATH entries, post-install GCC verification. - GCC bundle script —
scripts/prepare\_gcc\_bundle.ps1downloads and prepares the minimal toolchain. - Sync version metadata —
baa.rcandsetup.issupdated to0.3.2.4, publisher to "Omar Aglan".
---
Strategy (Canonical SSA / الطريقة القياسية لـ SSA):
-
Mem2Reg (ترقية الذاكرة إلى سجلات) بأسلوب Cytron/LLVM القياسي:
- حساب المسيطرات (Dominators) و حدود السيطرة (Dominance Frontiers)
- إدراج عقد فاي (Phi) عند نقاط الدمج (join points)
- إعادة التسمية (SSA Renaming) لبناء تعريفات واصلة (reaching definitions)
-
هذا الأسلوب هو الأساس طويل المدى لتحسينات متقدمة لاحقاً مثل: GVN/CSE و LICM و PRE وغيرها.
- Identify promotable allocas — Single-block allocas with no escaping (correctness-first baseline; design stays compatible with full Mem2Reg).
- Replace loads/stores — Convert to direct register use.
- Remove dead allocas — Delete promoted
حجزinstructions.
- Compute dominance frontiers — Where Phi nodes are needed.
- Insert Phi placeholders — Add
فايat join points. - Rename variables — SSA renaming pass with reaching definitions.
- Connect Phi operands — Link values from predecessor blocks.
- Verify SSA properties — Each register defined exactly once.
- Check dominance — Definition dominates all uses.
- Validate Phi nodes — One operand per predecessor.
-
--verify-ssaflag — Debug option to run SSA checks.
---
- Enable compiler warnings (two-tier) — Default warnings on; optional
-Werrorhardening toggle. - Fix unsafe string building in driver — Replace
sprintf/strcpy/strcatcommand construction with bounded appends and overflow checks. - Fix symbol-table name overflow — Guard
Symbol.name\[32]writes; reject/diagnose identifiers that exceed the limit. - Harden updater version parsing — Support multi-part versions like
0.3.2.5.3; replacesprintfwithsnprintf; check parse results. - Audit
strncpyusage — Ensure explicit NUL-termination and bounds safety in lexer and helpers. - Replace
atoiwith checked parsing — Usestrtoll+ validation for integer literals and array sizes; produce safe diagnostics. - Warning clean build — Zero warnings under default warning set;
-Werrorbuild passes.
✅ COMPLETED (2026-02-11)
- Arena allocator for IR — Fast allocation, bulk deallocation.
- IR cloning — Deep copy of functions/blocks.
- IR destruction — Clean up all IR memory.
- Def-use chains for SSA regs — Build and maintain use lists to make IR passes fast and safe (avoid whole-function rescans).
- Instruction numbering / stable IDs — Deterministic per-function instruction IDs for analyses, debugging, and regression tests.
- IR mutation helpers — Central utilities to insert/remove instructions and update CFG metadata (pred/succ/dominance caches) consistently.
✅ COMPLETED (2026-02-11)
- Source location tracking — Map IR instructions to source lines.
- Variable name preservation — Keep original names for debugging.
-
--debug-infoflag — Emit debug metadata in assembly.
✅ COMPLETED (2026-02-11)
- Text IR writer — Output canonical IR text format.
- Text IR reader — Parse IR text back to data structures.
- Round-trip testing — Write → Read → Compare.
✅ COMPLETED (2026-02-12)
- Fix liveness across loop back-edges — Linear scan liveness analysis does not correctly propagate live ranges across loop back-edges when many variables are simultaneously live, causing register clobbering and segfaults.
- Extend live intervals to loop ends — Ensure variables used inside loops have their intervals extended to cover the entire loop body including back-edges.
- Add block-level scoping in semantic analyzer — Currently function-level only; for-loop variables cannot be redeclared in the same function, requiring unique names.
- Stress test with high register pressure — Validate fix with functions containing 8+ live variables across multiple nested loops.
✅ COMPLETED (2026-02-13)
- IR well-formedness verifier (
--verify-ir) — Validate operand counts, type consistency, terminator rules, phi placement, and call signatures (separate from--verify-ssa). - Verifier gate in optimizer (debug) — Optional mode to run
--verify-ir/--verify-ssaafter each pass iteration to catch pass bugs early. - Canonicalization pass — Normalize commutative operands, constant placement, and comparison canonical forms to make CSE/DCE/constfold more effective.
- CFG simplification pass — Merge trivial blocks, remove redundant branches, and provide a reusable critical-edge splitting utility for IR passes.
- Define IR arithmetic semantics — Document and enforce overflow behavior (recommended: two’s-complement wrap), and clarify
i1truthiness anddiv/modrules for negatives. - Data layout helpers — Add size/alignment queries per
IRType(incl. pointer size) as the foundation for futureTargetabstraction and correct aggregate lowering. - Memory model contract — Specify and verify rules for
حجز/حمل/خزن(typed pointers, aliasing assumptions, and what is/ isn’t legal for optimization).
✅ COMPLETED (2026-02-14)
- Fix SSA verification failure — Resolved dominance issue in CSE pass for
switchstatements withdefaultcases.
---
✅ COMPLETED (2026-02-16)
- Loop detection — Identify natural loops via back edges.
- Loop invariant code motion — Hoist constant computations.
- Strength reduction — Replace expensive ops (mul → shift).
- Loop unrolling — Optional with
-funroll-loops.
✅ COMPLETED (2026-02-16)
- Inline heuristics — Small functions, single call site.
- Inline expansion — Copy function body to call site.
- Post-inline cleanup — Re-run optimization passes.
✅ COMPLETED (2026-02-17)
- Detect tail calls —
callimmediately followed byret(بدون تعليمات بينهما). - Convert to jump — Replace call+ret with a tail jump (no new return address).
- Stack reuse — Reuse caller's stack frame + caller shadow space (Windows x64 ABI).
- Limitation (for v0.3.2.7.3) — initial implementation supports only <= 4 arguments (register args); stack-args tail calls are scheduled in v0.3.2.8.5.
---
✅ COMPLETED (2026-02-17)
- Define
Targetinterface — OS/object-format, data layout, calling convention, asm directives. - x86-64 Windows target — Keep current behavior as the first concrete target.
- Host default target — Windows host defaults to
x86\_64-windows, Linux host defaults tox86\_64-linux. - Target selection —
--target=x86\_64-windows|x86\_64-linuxflag.
✅ COMPLETED (2026-02-17)
- Define
CallingConvstruct — arg regs order/count, return regs, caller/callee-saved masks. - Stack rules — stack alignment + varargs rules are modeled; stack-arg placement is deferred (backend rejects stack args for now).
- Windows x64 ABI — RCX/RDX/R8/R9 + 32-byte shadow/home space.
- SystemV AMD64 ABI — RDI/RSI/RDX/RCX/R8/R9, no shadow space, sets
AL=0for calls (conservative).
✅ COMPLETED (2026-02-17)
- Small code model — Default (only supported model in v0.3.2.8.3).
- PIC/PIE flags —
-fPIC/-fPIE(Linux/ELF; initial support). - Stack protection — stack canaries on ELF via
-fstack-protector\*.
✅ COMPLETED (2026-02-17)
- Native Linux build of compiler — build
baaon Linux with GCC/Clang + CMake. - SystemV AMD64 ABI implementation — different calling convention from Windows.
- ELF output support —
.rodata/.data/.textdirectives compatible with ELF GAS. - Link with host gcc (for now) — produce ELF executables via host toolchain; later reduce/remove GCC dependency.
- Cross-compilation (later) — optional
--target=x86\_64-linuxfrom Windows once a cross toolchain story exists.
✅ COMPLETED (2026-02-17)
- Proper stack-arg calling — outgoing call frames support stack args on Windows x64 and SysV AMD64.
- Tail calls beyond reg-args — enable TCO with stack args conservatively (requires enough incoming stack-arg area).
- Varargs home space (Windows) — home/register args are written into shadow space before calls.
✅ COMPLETED (2026-02-17)
Goal: move toward compiler-grade IR optimizations in pragmatic steps.
- InstCombine — local simplification patterns (canonical
COPYrewrites). - SCCP — sparse conditional constant propagation +
br\_condfolding. - GVN — dominator-scoped global value numbering for pure expressions.
- Mem2Reg promotability unlock — must-def initialization analysis (instead of “init store must be in alloca block”).
- Pipeline wiring — run InstCombine+SCCP early; GVN at
-O2before CSE.
---
- Well-formedness checks — All functions have entry blocks.
- Type consistency — Operand types match instruction requirements.
- CFG integrity — All branches point to valid blocks.
- SSA verification — Run
--verify-ssaon all test programs. -
baa --verifymode — Run all verification passes.
- Compile-time benchmark — Compare compiler-only (
-S) and end-to-end compile wall time. - Runtime benchmark — Run deterministic
bench/runtime\_\*.baaprograms. - Memory usage profiling — Track peak RSS on Linux via
/usr/bin/time -vand IR arena stats via--time-phases. - Benchmark suite — Collection of representative programs (
bench/\*.baa).
- Output comparison — Compare IR-based output against a reference corpus.
- Test all v0.2.x programs — Ensure backward compatibility.
- Edge case testing — Complex control flow, nested loops, recursion.
- Error case testing — Verify error messages unchanged.
- Update INTERNALS.md — Document new IR pipeline.
- IR Developer Guide — How to add new IR instructions.
- Driver split — Extract CLI parsing, toolchain execution, and per-file compile pipeline into dedicated
src/driver\_\*.c/.hmodules. - Driver link safety — Remove fixed-size
argv\_linkconstruction; build link argv dynamically based on object count. - Shared file reader — Provide
read\_file()as a shared module (src/read\_file.c) for the lexer include system. - Line ending normalization — Add
.gitattributesto keep the repo LF-normalized and reduce diff churn. - Remove deprecated code — Remove legacy AST-based codegen paths and backend-compare mode.
- Code review checklist — Ensure code quality standards.
---
Goal: Add essential features to make Baa practical for real-world programs and suitable for future staged bootstrap experiments, without making self-hosting part of the current release path.
Goal: Enable direct initialization of arrays with values.
- Array Literal Syntax – Initialize arrays with comma-separated values using
{}(supports partial init + zero-fill like C).
Syntax:
صحيح قائمة\[٥] = {١، ٢، ٣، ٤، ٥}.
// With Arabic comma (،) or regular comma (,)
صحيح أرقام\[٣] = {١٠، ٢٠، ٣٠}.
- Parser: Handle
{}initializer list after array declaration. - Parser: Support both Arabic comma
،(U+060C) and regular comma,as separators. - Semantic Analysis: Allow partial init (
count <= size) and zero-fill the remainder; reject overflow. - Codegen: Emit
.datainitializers for globals and runtime stores for locals (including zero-fill).
- Multi-dimensional arrays:
صحيح مصفوفة\[٣]\[٤].✅ COMPLETED (2026-02-25) - Array length operator:
صحيح طول = حجم(قائمة) / حجم(صحيح).✅ COMPLETED (2026-02-25)
---
Goal: Add compound types for better code organization and type safety.
- Enum Declaration – Named integer constants with type safety.
- Struct Declaration – Group related data into composite types (supports nested structs + enum fields).
- Member Access – Use
:(colon) operator for accessing members.
Goal: Memory-efficient variant types for parsers and data structures.
- Union Declaration:
اتحاد قيمة {
صحيح رقم.
نص نص\_قيمة.
منطقي منطق.
}
- Union Usage:
اتحاد قيمة ق.
ق:رقم = ٤٢. // All members share same memory
ق:نص\_قيمة = "مرحبا". // Overwrites previous value
- Tagged Union Pattern (manual):
تعداد نوع\_قيمة { رقم، نص\_ق }
هيكل قيمة\_موسومة {
تعداد نوع\_قيمة نوع.
اتحاد قيمة بيانات.
}
- Token: Add
TOKEN\_UNIONforاتحادkeyword. - Parser: Parse union declaration similar to struct.
- Semantic: All members start at offset 0.
- Memory Layout: Size = max member size, align = max member align.
- Codegen: Generate union storage + member access code.
Complete Example:
// ١. تعريف التعداد (Enumeration)
تعداد لون {
أحمر،
أزرق،
أسود،
أبيض
}
// ٢. تعريف الهيكل (Structure)
هيكل سيارة {
نص موديل.
صحيح سنة\_الصنع.
تعداد لون لون\_السيارة.
}
صحيح الرئيسية() {
هيكل سيارة س.
س:موديل = "تويوتا كورولا".
س:سنة\_الصنع = ٢٠٢٤.
س:لون\_السيارة = لون:أحمر.
اطبع س:موديل.
اطبع س:سنة\_الصنع.
إذا (س:لون\_السيارة == لون:أحمر) {
اطبع "تحذير: السيارات الحمراء سريعة!".
}
إرجع ٠.
}
Enumerations:
- Token: Add
TOKEN\_ENUMforتعدادkeyword. - Parser: Parse enum declaration:
تعداد <name> { <members> }. - Parser: Support Arabic comma
،between enum members. - Semantic: Auto-assign integer values (0, 1, 2...).
- Semantic: Enum values accessible via
<enum\_name>:<value\_name>. - Type System: Add
TYPE\_ENUMtoDataType.
Structures:
- Token: Add
TOKEN\_STRUCTforهيكلkeyword. - Token: Add
TOKEN\_COLONfor:(already exists, verify usage). - Parser: Parse struct declaration:
هيكل <name> { <fields> }. - Parser: Parse struct instantiation:
هيكل <name> <var>. - Parser: Parse member access:
<var>:<member>. - Semantic: Track struct definitions in symbol table.
- Semantic: Validate member access against struct definition.
- Memory Layout: Calculate field offsets with padding/alignment (supports nested structs).
- Codegen: Emit struct storage + member access code.
---
Goal: Add a proper character type with UTF-8 source support.
ملاحظة: نوع عشري قُدِّم في v0.3.5 كثوابت/تخزين، واكتمل في v0.3.5.5 (عمليات + ABI).
- Character Type (
حرف) – Unicode scalar value stored as packed UTF-8 bytes plus length in a scalar. - String-Char Relationship – Strings (
نص) are represented as arrays ofحرف(حرف\[]) with indexing (اسم\[٠]). - Float Type (
عشري) – Deferred from v0.3.4.5 (introduced as a basic type + literals in v0.3.5; completed in v0.3.5.5 with ops/ABI).
Syntax:
حرف ح = 'أ'.
نص اسم = "أحمد". // Equivalent to: حرف اسم\[] = {'أ', 'ح', 'م', 'د', '\\0'}.
- Token: Already have
TOKEN\_CHARfor literals. - Token: Add
TOKEN\_KEYWORD\_CHARforحرفtype keyword. - Type System: Add
TYPE\_CHARtoDataTypeenum. - Semantic: Distinguish between
charandint. - Codegen: Store
حرفas packedi64(bytes + length) and support UTF-8 printing. - String Representation: Update internal string handling to use
حرف\[].
- String operations:
طول\_نص(),دمج\_نص(),قارن\_نص()
Goal: Make numeric types practical for systems programming: sized integers + usable عشري (f64).
- Sized Integer Types:
ص٨ بايت\_موقع = -١٢٨. // int8\_t: -128 to 127
ص١٦ قصير = -٣٢٠٠٠. // int16\_t: -32768 to 32767
ص٣٢ عادي = -٢٠٠٠٠٠٠٠٠٠. // int32\_t
ص٦٤ طويل = ٩٠٠٠٠٠٠٠٠٠٠٠٠. // int64\_t (current صحيح)
ط٨ بايت = ٢٥٥. // uint8\_t
ط١٦ قصير٢ = ٦٥٠٠٠. // uint16\_t
ط٣٢ عادي٢ = ٤٠٠٠٠٠٠٠٠٠. // uint32\_t
ط٦٤ طويل٢ = ١٨٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠. // uint64\_t
-
C-like semantics:
- integer promotions + usual arithmetic conversions
- correct signed/unsigned comparisons
- correct
div/modsemantics for signed vs unsigned
-
عشريusability:- arithmetic
+ - \* / - comparisons
== != < > <= >= اطبعsupportsعشري- ABI lowering on SysV AMD64 + Windows x64 (XMM regs + SysV varargs rules)
- arithmetic
- Lexer: Tokenize
ص٨,ص١٦,ص٣٢,ص٦٤,ط٨,ط١٦,ط٣٢,ط٦٤. - Type System: Add size and signedness to integer types.
- IR: Add unsigned variants and allow
f64ops + verifier updates. - Optimizer: Ensure integer/float correctness (avoid invalid float folds; unsigned-aware folds).
- ISel/Emitter: Generate correct-sized integer ops and scalar SSE2 for
f64. - ABI (Windows + SystemV): Pass/return
عشريin XMM registers; handle SysV varargs rules. - Semantic: Warn on implicit narrowing conversions.
- Semantic: Handle signed/unsigned comparison warnings.
---
Goal: Add bitwise operations and low-level features needed for systems programming.
- Bitwise Operators:
صحيح أ = ٥ \& ٣. // AND: 5 \& 3 = 1
صحيح ب = ٥ | ٣. // OR: 5 | 3 = 7
صحيح ج = ٥ ^ ٣. // XOR: 5 ^ 3 = 6
صحيح د = \~٥. // NOT: \~5 = -6
صحيح هـ = ١ << ٤. // Left shift: 1 << 4 = 16
صحيح و = ١٦ >> ٢. // Right shift: 16 >> 2 = 4
- Sizeof Operator:
صحيح حجم\_صحيح = حجم(صحيح). // Returns 8
صحيح حجم\_حرف = حجم(حرف). // Returns 1
صحيح حجم\_مصفوفة = حجم(قائمة). // Returns array size in bytes
- Void Type:
عدم اطبع\_رسالة() {
اطبع "مرحباً".
// No return needed
}
- Escape Sequences:
نص سطر = "سطر١\\س سطر٢". // Newline (/س)
نص جدول = "عمود١\\ت عمود٢". // Tab (/ت)
نص مسار = "C:\\\\ملفات". // Backslash
حرف صفر = '\\٠'. // Null character
- Lexer: Tokenize
\&,|,^,\~,<<,>>. - Parser: Add bitwise operators with correct precedence.
- Parser: Parse
حجم(type)andحجم(expr)expressions. - Lexer: Add
عدمkeyword for void type. - Lexer: Handle escape sequences in string/char literals.
- Semantic: Type check bitwise operations (integers only).
- Codegen: Generate bitwise assembly instructions.
- Codegen: Calculate sizes for
حجمoperator.
Goal: Create custom type names for readability and abstraction.
- Simple Type Alias:
نوع معرف = ط٦٤.
نوع نتيجة = ص٣٢.
معرف رقم\_المستخدم = ١٢٣٤٥.
نتيجة كود\_خطأ = -١.
- Pointer Type Alias:
نوع نص\_ثابت = ثابت حرف\*.
نوع مؤشر\_بايت = ط٨\*.
(Deferred — requires pointer type grammar from v0.3.10.)
-
Token/AST plumbing: Added
TOKEN\_TYPE\_ALIAS/NODE\_TYPE\_ALIASsupport in shared structures. -
Parser: Parse
نوع <name> = <type>.at top-level with C-like declare-before-use semantics. -
Semantic: Resolve aliases during type checking and validate alias targets (
enum/struct/union). -
Symbol Table: Store type aliases separately and enforce strict name-collision diagnostics.
---
Goal: Refine and enhance existing compiler systems.
-
Error Messages – Improve clarity and helpfulness of diagnostic messages.
-
Code Quality – Refactor complex functions, improve code organization.
-
Memory Management – Fix memory leaks, improve buffer handling.
-
Performance – Profile and optimize slow compilation paths.
-
Documentation – Update all docs to reflect v0.3.3-0.3.7 changes.
-
Edge Cases – Fix known bugs and handle corner cases.
-
Improve panic mode recovery in parser.
-
Better handling of UTF-8 edge cases in lexer.
-
Optimize symbol table lookups (consider hash table).
-
Add more comprehensive error recovery.
-
Improve assembly output readability (comments in assembly).
Goal: Variables that persist between function calls.
-
Static Local Syntax:
صحيح عداد() { ساكن صحيح ع = ٠. // Initialized once, persists ع = ع + ١. إرجع ع. } // First call returns 1, second returns 2, etc. -
Token: Add
TOKEN\_STATICforساكنkeyword. -
Semantic: Static locals go in .data section, not stack.
-
Codegen: Generate unique global label for static locals.
-
Codegen: Initialize in .data section.
---
Goal: Establish robust testing infrastructure and fix accumulated issues.
-
Test Framework – Create automated test runner.
- Script to compile and run
.baatest files. - Compare actual output vs expected output.
- Report pass/fail with clear diagnostics.
- Script to compile and run
-
Test Categories:
- Lexer Tests – Token generation, UTF-8 handling, preprocessor.
- Parser Tests – Syntax validation, error recovery.
- Semantic Tests – Type checking, scope validation.
- Codegen Tests – Correct assembly output, execution results.
- Integration Tests – Full programs with expected output.
-
Test Coverage:
- All language features (v0.0.1 - v0.3.7).
- Edge cases and corner cases.
- Error conditions (syntax errors, type mismatches, etc.).
- Multi-file compilation scenarios.
- Preprocessor directive combinations.
-
GitHub Actions workflow:
name: Baa CI on: \[push, pull\_request] jobs: build-and-test: runs-on: windows-latest steps: - uses: actions/checkout@v3 - name: Build Baa run: gcc src/\*.c -o baa.exe - name: Run Tests run: ./run\_tests.bat
-
Known Issues – Fix all open bugs from previous versions.
-
Regression Testing – Ensure new features don't break old code.
-
Stress Testing – Test with large files, deep nesting, many symbols.
-
Arabic Text Edge Cases – Test various Arabic Unicode scenarios.
---
Goal: Complete array and string functionality.
-
Multi-dimensional Arrays ✅ COMPLETED (2026-02-25):
صحيح مصفوفة\[٣]\[٤]. مصفوفة\[٠]\[٠] = ١٠. مصفوفة\[١]\[٢] = ٢٠. -
Array Length Operator ✅ COMPLETED (2026-02-25):
صحيح قائمة\[١٠]. صحيح الطول = حجم(قائمة) / حجم(صحيح). // Returns 10 -
Array Bounds Checking (Optional runtime mode) ✅ COMPLETED (2026-02-25; flag contract stabilized 2026-05-05):
- Runtime checks in explicit
-fruntime-checkslowering mode. - Deterministic
exit(1)path on out-of-bounds access.
- Runtime checks in explicit
-
String Length ✅ COMPLETED (2026-02-25):
صحيح الطول = طول\_نص(اسم). -
String Concatenation ✅ COMPLETED (2026-02-25):
نص كامل = دمج\_نص(اسم, " علي"). -
String Comparison ✅ COMPLETED (2026-02-25):
صحيح نتيجة = قارن\_نص(اسم, "محمد"). -
String Indexing (read-only) ✅ COMPLETED (2026-02-25):
حرف أول = اسم\[٠]. -
String Copy ✅ COMPLETED (2026-02-25):
نص نسخة = نسخ\_نص(اسم). -
Parser: Parse multi-dimensional array declarations and access.
-
Semantic: Track array dimensions in symbol table.
-
Codegen: Calculate offsets for multi-dimensional arrays (row-major order).
-
Standard Library: Create
baalib.baawith string functions. -
UTF-8 Aware: Ensure functions handle multi-byte Arabic characters correctly.
---
Goal: Add pointer types for manual memory management and data structures.
-
Pointer Type Declaration ✅ COMPLETED (2026-02-25):
صحيح\* مؤشر. // Pointer to integer حرف\* نص\_مؤشر. // Pointer to character (C-string) هيكل سيارة\* س\_مؤشر. // Pointer to struct -
Address-of Operator (
\&) ✅ COMPLETED (2026-02-25):صحيح س = ١٠. صحيح\* م = \&س. // م points to س -
Dereference Operator (
\*) ✅ COMPLETED (2026-02-25):صحيح قيمة = \*م. // قيمة = 10 \*م = ٢٠. // س now equals 20 -
Null Pointer ✅ COMPLETED (2026-02-25):
صحيح\* م = عدم. // Null pointer إذا (م == عدم) { اطبع "مؤشر فارغ". } -
Pointer Arithmetic ✅ COMPLETED (2026-02-25):
صحيح قائمة\[٥] = {١، ٢، ٣، ٤، ٥}. صحيح\* م = \&قائمة\[٠]. م = م + ١. // Points to قائمة\[١] اطبع \*م. // Prints 2 -
Lexer/Parser integration: Handle
\*في سياق النوع/فك الإشارة والضرب و\&كـ bitwise/address-of. -
Parser: Parse pointer declarations +
عدمكمؤشر فارغ + جملة\*ptr = value.. -
Type System: Add
TYPE\_POINTERwith base type tracking in AST/symbol metadata. -
Semantic: Validate pointer operations (dereference/address-of/null/pointer compare/arithmetic).
-
Codegen: Lower address-of/dereference/pointer assignment and pointer arithmetic safely.
Goal: Explicit type conversions for low-level programming.
-
Cast Syntax:
صحيح س = ٦٥. حرف ح = كـ<حرف>(س). -
Numeric Casts:
ص٣٢ صغير = كـ<ص٣٢>(قيمة\_كبيرة). // Truncation ص٦٤ كبير = كـ<ص٦٤>(قيمة\_صغيرة). // Sign extension ط٦٤ بدون = كـ<ط٦٤>(موقع). // Signed to unsigned -
Pointer Casts:
ط٨\* بايتات = كـ<ط٨\*>(مؤشر\_هيكل). // Reinterpret عدم\* عام = كـ<عدم\*>(أي\_مؤشر). // To void pointer هيكل س\* محدد = كـ<هيكل س\*>(عام). // From void pointer -
Pointer Difference (
pointer - pointer):صحيح\* أ = \&قائمة\[٠]. صحيح\* ب = أ + ٣. صحيح فرق = ب - أ. // = 3 (فرق عناصر) -
Lexer: Tokenize
كـkeyword and<>for type parameter. -
Parser: Parse
كـ<type>(expr)form. -
Semantic: Validate cast safety, warn on dangerous casts.
-
Codegen: Generate appropriate conversion instructions.
Goal: First-class function references for callbacks and dispatch tables.
-
Function Pointer Type:
// Pointer to function taking two صحيح, returning صحيح نوع دالة\_ثنائية = دالة(صحيح، صحيح) -> صحيح. // Or inline دالة(صحيح، صحيح) -> صحيح مؤشر\_دالة. -
Assign Function to Pointer:
صحيح جمع(صحيح أ، صحيح ب) { إرجع أ + ب. } صحيح ضرب(صحيح أ، صحيح ب) { إرجع أ \* ب. } دالة\_ثنائية عملية = جمع. // Points to جمع عملية = ضرب. // Now points to ضرب -
Call Through Pointer:
صحيح نتيجة = عملية(١٠، ٢٠). // Calls ضرب(10, 20) = 200 -
Function Pointer as Parameter:
صحيح طبق(صحيح\[] قائمة، صحيح حجم، دالة\_ثنائية د) { صحيح نتيجة = قائمة\[٠]. لكل (صحيح ع = ١؛ ع < حجم؛ ع++) { نتيجة = د(نتيجة، قائمة\[ع]). } إرجع نتيجة. } // Usage صحيح مجموع = طبق(أرقام، ١٠، جمع). -
Null Function Pointer:
دالة\_ثنائية فارغ = عدم. إذا (فارغ != عدم) { فارغ(١، ٢). } -
Parser: Parse function type syntax
دالة(...) -> نوع. -
Type System: Add function pointer type with signature plumbing.
-
Semantic: Type-check function pointer assignments.
-
Semantic: Validate call through pointer matches signature.
-
Codegen: Generate indirect call instructions.
-
IR: Add function pointer type to IR.
✅ COMPLETED (2026-02-28)
---
Goal: Enable heap allocation for dynamic data structures.
-
Memory Allocation:
// Allocate memory for 10 integers صحيح\* قائمة = حجز\_ذاكرة(١٠ \* حجم(صحيح)). // Allocate memory for a struct هيكل سيارة\* س = حجز\_ذاكرة(حجم(هيكل سيارة)). -
Memory Deallocation:
تحرير\_ذاكرة(قائمة). تحرير\_ذاكرة(س). -
Memory Reallocation:
// Resize array to 20 integers قائمة = إعادة\_حجز(قائمة, ٢٠ \* حجم(صحيح)). -
Memory Operations:
// Copy memory نسخ\_ذاكرة(وجهة, مصدر, حجم). // Set memory to value تعيين\_ذاكرة(مؤشر, ٠, حجم). -
Runtime: ربط مباشر مع libc (
malloc/free/realloc/memcpy/memset). -
Built-in Functions: إضافة
حجز\_ذاكرة,تحرير\_ذاكرة,إعادة\_حجز,نسخ\_ذاكرة,تعيين\_ذاكرة. -
Semantic: دعم
عدم\*(void*) كـ مؤشّر عام (تحويلات ضمنية مع مؤشرات الكائنات). -
Codegen: خفض الدوال إلى استدعاءات C القياسية مع قواعد shadowing.
✅ COMPLETED (2026-03-01)
---
Goal: Enable reading and writing files for systems programs and future staged bootstrap experiments.
-
File Opening:
عدم\* ملف = فتح\_ملف("بيانات.txt", "قراءة"). عدم\* ملف\_كتابة = فتح\_ملف("ناتج.txt", "كتابة"). عدم\* ملف\_إضافة = فتح\_ملف("سجل.txt", "إضافة"). -
File Reading:
حرف حرف\_واحد = اقرأ\_حرف(ملف). نص سطر = اقرأ\_سطر(ملف). صحيح بايتات = اقرأ\_ملف(ملف, مخزن, حجم). -
File Writing:
اكتب\_حرف(ملف, 'أ'). اكتب\_سطر(ملف, "مرحباً"). اكتب\_ملف(ملف, بيانات, حجم). -
File Closing:
اغلق\_ملف(ملف). -
File Status:
منطقي انتهى = نهاية\_ملف(ملف). صحيح موقع = موقع\_ملف(ملف). اذهب\_لموقع(ملف, ٠). -
Runtime: Wrap C stdio functions (fopen, fread, fwrite, fclose, fgetc, fputc, fputs, feof, ftello/fseeko).
-
Built-in Functions: Add file operation functions using
عدم\*as an opaqueFILE\*handle. -
Error Handling: Return error codes for failed operations (
فتح\_ملفيعيدعدم، واكتب\_سطر/اكتب\_حرفتعيد -1 عند الفشل). -
Codegen: Generate direct libc stdio calls with shadowing rules.
✅ COMPLETED (2026-03-02)
Goal: Access program arguments for general programs and future staged bootstrap experiments.
-
Main with Arguments:
صحيح الرئيسية(صحيح عدد، نص\[] معاملات) { // عدد = argument count (like argc) // معاملات = argument array (like argv) إذا (عدد < ٢) { اطبع "الاستخدام: برنامج <ملف>". إرجع ١. } نص اسم\_البرنامج = معاملات\[٠]. نص ملف\_إدخال = معاملات\[١]. اطبع "تجميع: ". اطبع ملف\_إدخال. إرجع ٠. } -
Parser: Allow parameters in
الرئيسيةfunction. -
Semantic: Validate main signature matches expected pattern.
-
Codegen: Link with proper C runtime entry point.
-
Codegen (Opt-in):
--startup=custom— custom entrypoint symbol (\_\_baa\_start) while keeping CRT/libc init. -
Codegen (Full Independence): True
\_startwithout CRT/libc (deferred to Phase 8).✅ COMPLETED (2026-03-02)
---
Goal: Make Baa production-ready with a comprehensive standard library.
Goal: Professional I/O capabilities.
-
Formatted Output:
اطبع\_منسق("الاسم: %ن، العمر: %ص\\س", اسم, عمر). -
String Formatting:
نص رسالة = نسق("النتيجة: %ص", قيمة). حرر\_نص(رسالة). -
Formatted Input:
نص سطر = اقرأ\_سطر(). صحيح رقم = اقرأ\_رقم(). صحيح أ = ٠. عشري ب = ٠. نص س = عدم. // ملاحظة: في الإدخال، %ن يتطلب عرضاً رقمياً (مثلاً %10ن). صحيح مقروء = اقرأ\_منسق("%ص %ع %10ن", \&أ, \&ب, \&س). إذا (مقروء == 3) { حرر\_نص(س). }✅ COMPLETED (2026-03-02)
Goal: Functions accepting variable number of arguments.
-
Variadic Declaration:
عدم اطبع\_منسق(نص تنسيق، ...) { // Implementation using variadic access } -
Variadic Access Macros/Functions:
عدم اطبع\_أرقام(صحيح عدد، ...) { قائمة\_معاملات معاملات. بدء\_معاملات(معاملات، عدد). لكل (صحيح ع = ٠؛ ع < عدد؛ ع++) { صحيح قيمة = معامل\_تالي(معاملات، صحيح). اطبع قيمة. } نهاية\_معاملات(معاملات). } // Usage اطبع\_أرقام(٣، ١٠، ٢٠، ٣٠). -
Lexer: Tokenize
...(ellipsis). -
Parser: Parse variadic function declarations (including
دالة(...)->...signatures). -
Type System: Handle variadic function types and variadic call arity/type checks.
-
Codegen (Windows x64): Variadic calls lowered عبر وسيط داخلي موحد (
\_\_baa\_va\_base) متوافق مع مسار الباك-إند الحالي. -
Codegen (Linux x64): نفس وسيط المعاملات الداخلي لضمان سلوك موحد على
x86\_64-linux. -
Built-ins: Implement
بدء\_معاملات,معامل\_تالي,نهاية\_معاملات.✅ COMPLETED (2026-03-02)
Goal: Embed assembly code for low-level operations.
-
Basic Inline Assembly:
مجمع { "nop" } -
With Outputs and Inputs:
صحيح قراءة\_عداد() { ط٣٢ منخفض. ط٣٢ مرتفع. مجمع { "rdtsc" : "=a" (منخفض)، "=d" (مرتفع) } إرجع (كـ<ص٦٤>(مرتفع) << ٣٢) | كـ<ص٦٤>(منخفض). } -
Token: Add
TOKEN\_ASMforمجمعkeyword. -
Parser: Parse inline assembly blocks.
-
Codegen: Emit assembly directly with proper constraints.
-
Semantic: Validate constraint syntax.
✅ COMPLETED (2026-03-02)
-
Full constraint support (memory, register classes)
-
Clobber lists
-
Math Module —
جذر\_تربيعي(),أس(),مطلق(),عشوائي(). -
String Module — Complete string manipulation.
-
IO Module — File and console operations.
-
System Module — Environment variables, command execution.
-
Time Module — Date/time operations.
✅ COMPLETED (2026-03-02)
Goal: Extend floating point beyond the core
عشري(completed in v0.3.5.5). -
Math functions —
جذر\_تربيعي(),أس(),جيب(),جيب\_تمام(),ظل(). -
Formatting — better float printing options (precision + scientific
%أ). -
Additional float types —
عشري٣٢keyword (current lowering alias toعشري/f64 in v0.4.2).✅ COMPLETED (2026-03-02)
Goal: Graceful error management.
-
Assertions:
تأكد(س > ٠, "س يجب أن يكون موجباً"). -
Error Codes – Standardized error return values.
-
Panic Function –
توقف\_فوري("رسالة خطأ").✅ COMPLETED (2026-03-02)
-
Complete Documentation — All features documented.
-
Tutorial Series — Step-by-step learning materials.
-
Example Programs — Comprehensive example collection.
-
Performance Optimization — Profile and optimize compiler.
✅ COMPLETED (2026-03-02)
Goal: Keep the C implementation as the official reference compiler, stabilize the language/toolchain contracts, and defer self-hosting to a future staged effort after the language has matured.
-
Define canonical component boundaries — Frontend / Middle-End / Backend / Driver / Support.
-
Set module-size policy — target
<= 700lines/file, hard cap1000lines for hand-written C modules. -
Split oversized modules first —
analysis.c,emit.c,ir.c,ir\_lower.c,ir\_text.c,isel.c,lexer.c,parser.c,regalloc.c, andir\_verify\_ir.care now under the hard cap via companion implementation splits. -
Restructure source layout safely — component directories now exist under
src/, and the build now targets those files directly. -
Add local module facades —
frontend\_internal.h,middleend\_internal.h,backend\_internal.h,driver\_internal.h, andsupport\_internal.hnow define component-local include surfaces. -
Update build graph —
CMakeLists.txtremains explicit/deterministic and the Windows build uses C-only include propagation while header wrappers remain transitional. -
Add size-regression guard —
scripts/check\_module\_sizes.pyenforces warn700/ error1000and runs inqa\_run.py+ CI before full QA. -
Document ownership map —
docs/COMPONENT\_OWNERSHIP.mddefines module responsibilities + dependency rules.✅ COMPLETED (2026-03-06)
Partial status update (2026-03-06):
-
policy/guard/documentation are in place for
v0.5.0, -
all remaining hard-cap hotspots were split below the
1000-line limit, -
scripts/module\_size\_allowlist.txtis now empty, -
source files were reorganized under
src/frontend,src/middleend,src/backend,src/driver, andsrc/support, -
CMakeLists.txtnow builds directly from component sources, while root-level compatibility is limited to selected header wrappers during header migration. -
Freeze grammar surface — avoid syntax churn before bootstrap.
-
Freeze stdlib signatures — lock callable contracts used by compiler-in-Baa.
-
Freeze target ABI contracts — Windows x64 + SystemV AMD64 invariants.
-
Freeze IR invariants — verifier-enforced guarantees documented.
✅ COMPLETED (2026-04-28)
-
Deterministic include/import resolution — include resolution now canonicalizes successful paths before they become active lexer filenames, so equivalent relative spellings collapse to a single resolved path.
-
Cycle diagnostics —
#تضمينcycles are now rejected early with Arabic diagnostics that print the include chain instead of recursing until depth exhaustion. -
Symbol visibility rules — top-level functions keep external linkage by default, top-level
ساكنglobals/arrays keep file-local internal linkage, and multi-file QA now locks this contract with dedicated smoke coverage. -
Header/API hygiene —
baa.his now a compatibility umbrella only; shared declarations were split into component-owned public headers undersrc/frontend/andsrc/support/, diagnostics no longer depend on frontend lexer headers, and the middle-end now consumes a small shared target contract instead of touching backend target layout directly. -
Incremental compilation model — avoid full rebuilds on small edits.
-
Dependency tracking — reliable invalidation for headers/includes.
-
Reproducible outputs — stable artifacts for same inputs/toolchain.
-
Build profile presets — dev/debug/release/verify presets.
✅ COMPLETED (2026-04-28)
-
Improve span accuracy — tighter line/column ranges.
-
Add actionable fix hints — Arabic-first suggestions for common errors.
-
Strengthen panic recovery — fewer cascading diagnostics.
-
Negative test expansion — enforce diagnostic contracts.
✅ COMPLETED (2026-05-01)
-
Assertion runtime contract — stable behavior in debug/release modes.
-
Panic/error-code policy — consistent fatal/non-fatal paths.
-
Safety toggles — explicit compile-time/runtime control flags.
-
Document failure semantics — deterministic exit/status behavior.
✅ COMPLETED (2026-05-05)
-
Cross-target parity suite — Linux/Windows behavior consistency.
-
Fuzz + stress expansion — parser/semantic/IR robustness.
-
IR/SSA regression locking — snapshots + verifier gating.
-
Release gate checklist — mandatory pass criteria before Phase 5.
✅ COMPLETED (2026-05-09)
These items are future planning work, not Phase 4.5 release gates. They must not add a Baa-built compiler dependency to the mainline build.
-
Define minimal future subset — features that could later support compiler slices in Baa without depending on unstable language behavior.
-
Ban unstable features in Baa0 — keep any future bootstrap surface conservative and deterministic.
-
Publish Baa0 compliance suite — tests for subset guarantees, but not a production migration gate yet.
-
Document migration policy — C remains the reference compiler; Baa rewrites stay experimental until post-v0.9 staged gates.
Goal: Stop broad compiler migration work and re-anchor the project around a stable C reference compiler.
-
Declare the C compiler as the reference implementation —
docs/BOOTSTRAP_CONTRACT.mddefines the root CMake target as the official implementation. -
Move C→Baa migration work to an experimental branch —
origin/moving-to-baapreserves the Baa lexer/parser and bootstrap wiring outside the release path. -
Remove misleading bootstrap assumptions from the main build — the C-only build has no bootstrap input, and
scripts/check\_reference\_compiler\_policy.pyprevents regressions. -
Audit migration artifacts —
docs/MIGRATION\_ARTIFACT\_AUDIT.mdrecords branch contents and the keep/defer/re-evaluate disposition. -
Write self-hosting policy note —
docs/BOOTSTRAP_CONTRACT.mdkeeps future work staged, parity-tested, rollback-ready, and outside the v0.9 release path. -
Update roadmap language — current milestones use future staged bootstrap readiness rather than active rewrite framing.
✅ COMPLETED (2026-06-29)
Goal: Produce a clean, reproducible, cross-platform baseline before new v0.6.x language work.
-
Windows full QA signoff — strict v0.5.9 C build plus
quick7/7,full22/22,stress52/52, andrelease53/53 passed in Actions run28384736088. -
Linux full QA signoff — strict v0.5.9 C build plus
quick7/7,full22/22,stress52/52, andrelease53/53 passed in Actions run28384736088. -
Reproducible build check — Windows/Linux determinism receipts passed 14/14, including stable version/build-date and manifest bytes/shape.
-
Determinism gate — Windows/Linux receipts lock raw/optimized IR, assembly, diagnostics, manifests, verifier behavior, and snapshots.
-
Known limitations page —
docs/KNOWN\_LIMITATIONS.mdlists unsupported targets, language/type restrictions, safety boundaries, and draft-only tooling surfaces. -
Release branch discipline —
docs/RELEASE\_PROCESS.mdlimits post-cut work to focused fixes, tests, release gates, metadata, and documentation; both platform prerequisites are green.Reproducibility coverage update (2026-06-29): the release gate now compares repeated
--versionoutput (including the configured build date) and negative diagnostic text/exit status in addition to IR, assembly, manifests, verifier behavior, and snapshots. Final Windows and Linux receipts are green.RC gate reliability update (2026-06-29): compiler discovery now emits a structured
compiler-preflightresult, including missing/invalid compiler paths in summary JSON instead of aborting before a release receipt is written.Cross-platform receipt update (2026-06-29): the manual
Baa Release Candidateworkflow performs strict Windows/Linux C-reference builds, runs all four QA modes, and uploads both platform receipt sets.Version audit update (2026-06-29): authoritative compiler/package/documentation metadata now reports
0.5.9, guarded byscripts/check\_version\_sync.py. The Windows ladder was rebuilt and rerun on the corrected baseline; earlier 0.5.6 receipts remain test history only.✅ COMPLETED (2026-06-29) — final cross-platform run
28384736088onfef76ca. -
C-reference build is simple — clean checkout builds from C/RC inputs only, with the policy checked in every QA mode.
-
Cross-target QA green — all four QA modes pass on both
x86\_64-windowsandx86\_64-linux. -
Determinism checks green — stable IR text and stable diagnostics for identical inputs.
-
File-size governance active — CI guard for module-size budget is enforced.
-
Contracts frozen and published —
docs/CONTRACT\_FREEZE\_V0\_5.mdindexes the versioned v0.5.9 language, stdlib, hosted ABI, and IR baselines and explicitly excludes draft tooling contracts. -
Future bootstrap policy published — self-hosting is explicitly deferred until after v0.9 stabilization.
✅ PHASE 4.5 EXIT CRITERIA SATISFIED (2026-06-29)
-
docs/COMPONENT\_OWNERSHIP.md— boundaries + owners + allowed dependencies. -
docs/BOOTSTRAP\_CONTRACT.md— frozen ABI/IR/language requirements and future bootstrap policy. -
docs/MIGRATION\_ARTIFACT\_AUDIT.md— experimental-branch inventory and mainline disposition. -
docs/CONTRACT\_FREEZE\_V0\_5.md— authoritative v0.5.9 core contract publication index.Future optional artifacts (not Phase 4.5 gates):
-
docs/BAA0\_SPEC.md— post-v0.9 bootstrap subset definition and exclusions. -
tests/bootstrap/— post-v0.9 parity corpus for staged migration experiments.---
Goal: Keep the Baa repository focused on the compiler, language, ABI, diagnostics, stdlib contracts, and release-quality gates while sibling projects own their own product areas.
-
Takween owns the Arabic-first project build workflow for Baa projects (
تكوين تهيئة/بناء/تشغيل/تنظيف). Baa should expose stable compiler flags, manifest formats, include rules, and diagnostics for Takween to consume; Baa should not duplicate Takween as an internalbaa buildsystem. -
Qalam-IDE owns the editor/IDE experience for Arabic-syntax systems languages starting with Baa. Baa should expose stable parser/check/diagnostic surfaces that Qalam can call; Baa should not duplicate Qalam as an internal IDE or editor extension roadmap.
-
Baa owns the compiler core, language specification, standard-library contracts, runtime checks, diagnostics, target ABI behavior, tests, and release artifacts.
---
Goal: Make Baa more practical as an Arabic-first systems language without expanding into external build-system or IDE ownership.
-
خارجيdeclarations — explicit external function, scalar-global, and fixed-array declarations are supported in headers and multi-file builds. -
Global declaration vs definition rules — matching declarations merge with one definition; conflicting types/shapes and duplicate definitions are rejected.
-
Struct field initialization — basic named-field initialization for automatic local
هيكلvalues; static/global aggregate initializers remain deferred. -
Aggregate assignment policy — whole-aggregate copy assignment is explicitly rejected for variables, members, array elements, and dereferenced aggregate pointers with field-update guidance.
-
Const pointer rules —
ثابت T*freezes the pointer variable, pointer-to-const types remain unsupported, and taking a mutable pointer to aثابتobject is rejected. -
Better null-pointer diagnostics — direct dereference of the null literal
عدمis rejected with an explicit Arabic diagnostic; broader flow-sensitive null analysis remains deferred. -
Diagnostic codes — text diagnostics now include stable family identifiers such as
B0001,B1000, and warning-specificB110xcodes. -
Multi-line spans — diagnostic spans can cover multiple source lines, with semantic binary-expression errors using the wider range when operands cross lines.
-
Fix-it hints — parser expected-token diagnostics suggest missing
.,؛, and delimiters; semantic assignment type mismatches now suggest matching the value type or using explicit conversion. -
Diagnostic categories — text diagnostics derive category labels such as
syntax,semantic,include,backend,runtime,warning, andinternalfrom stable code families. -
--explain <CODE>— built-in Arabic explanations for the stable text diagnostic families and current warning codes. -
Negative diagnostic expansion — representative syntax, semantic, warning, null, hint, and multi-line-span negatives now lock diagnostic counts and selected cascade guards.
-
Dynamic array/vector API —
متجهprovides create/free/length/capacity/data/push/pop helpers for fixed-size element patterns, with byte-copy storage and explicit ownership notes. -
Byte buffer API —
مخزن_بايتاتprovides create/free/length/capacity/data plus byte append for compiler/tooling-style buffers. -
Path API —
ضم_مسار/مجلد_مسار/اسم_ملف_مسار/امتداد_مسار/طبع_مسارprovide owned-string lexical path helpers for join, dirname, basename, extension, and separator normalization. -
String builder —
باني_نصprovides owned incremental text construction with append, clear, length, snapshot, and explicit free helpers. -
Result/error helpers —
نتيجة_ناجحة/نتيجة_فاشلة/كود_نتيجةdocument and bridge the stdlibمنطقيsuccess and integer status-code conventions. -
Ownership documentation —
docs/STDLIB_OWNERSHIP.mdindexes owned results, borrowed pointers, and release helpers for public stdlib APIs. -
Null pointer checks —
-fruntime-checksnow emits optional traps before lowered pointer dereferences and*p = value, printingفشل_مؤشر_فارغbeforeexit(1). -
Division-by-zero checks —
-fruntime-checksnow emits optional traps before lowered integer division/modulo, printingفشل_قسمة_على_صفرbeforeexit(1). -
Shift-width checks —
-fruntime-checksnow emits optional traps before lowered shifts when the dynamic count is outside0..63, printingفشل_إزاحة_غير_صالحةbeforeexit(1). -
Expanded bounds checks —
-fruntime-checksnow covers static-shape arrays plusنص[i]and innerنص[]character indexes, printingفهرس خارج حدود النصfor text bounds failures. -
Readable panic format — fail-fast runtime paths now print
الموقع: file:line:col | الدالة: namebetween the Arabic failure marker and message. -
Selective safety flags —
-fruntime-checks=<list>now acceptsall,bounds,null,div-zero/div0/div,shift, andnonewith comma or plus separators. -
Clarify
حرفrepresentation —حرفis documented as one packed Unicode scalar value, not a raw byte or grapheme cluster. -
String indexing policy —
نص\[index]is documented as returning the indexed packedحرف/Unicode scalar value, not raw bytes or user-perceived graphemes. -
UTF-8 validation tests — focused coverage now checks valid UTF-8 identifiers/literals/includes plus malformed identifier, string, char, and included-file diagnostics.
-
Arabic numeral normalization tests — source-token parsing, diagnostic snippets, and
--dump-irArabic numeral output are covered by focused tests. -
Text stdlib helpers — safe length/copy/compare behavior is documented and covered for empty text, prefix comparison, bad calls, and owned-copy lifetime.
-
Known Unicode limitations — docs now explicitly disclaim normalization and grapheme-cluster-aware behavior.
-
Update Baa Book to current scope — stale v0.3.10.6 scope text, warning-flag wording, and example-review baseline were refreshed for current v0.6.x behavior.
-
Verified example suite —
tests/test_examples.pycompiles every publicexamples/*.baaprogram in QA with-O2 --verify. -
Exercises with expected output — Baa Book now includes beginner, intermediate, and systems-level exercises with exact output blocks.
-
Terminology glossary — one preferred Arabic term per core compiler/language concept is recorded in
docs/TERMINOLOGY_GLOSSARY.md. -
Native Arabic technical review — language quality pass by Arabic-speaking engineers.
-
Docs version sync gate — QA now rejects canonical docs whose top-level version header drifts from the CMake project version.
---
Goal: Strengthen Baa’s compiler-facing surfaces for Takween, Qalam-IDE, and future tooling without owning those external products inside this repository.
#### Required integration artifacts
-
docs/ECOSYSTEM\\\_BOUNDARIES.md— ownership rules between Baa, Takween, Qalam-IDE, and PyramidOS, covered bytests/test_integration_artifacts.py. -
docs/COMPATIBILITY\\\_MATRIX.md— version compatibility table for compiler/tooling contracts, covered bytests/test_integration_artifacts.py. -
docs/TOOLING\\\_CONTRACTS.md— stable CLI, manifest, exit-code, and machine-readable output contracts, covered bytests/test_integration_artifacts.py. -
docs/DIAGNOSTICS\\\_JSON\\\_SCHEMA.md— stable diagnostics JSON schema for Takween/Qalam, covered bytests/test_integration_artifacts.py. -
docs/TARGET\\\_SPECIFICATION.md— target descriptor model for hosted and future freestanding targets, now covered bytests/test_target_specs.py. -
docs/CONFORMANCE\\\_SUITE.md— language, ABI, stdlib, diagnostics, and target conformance plan, covered bytests/test_integration_artifacts.py. -
docs/SDK\\\_RELEASE\\\_PLAN.md— future Baa SDK bundle/versioning plan, covered bytests/test_integration_artifacts.py. -
targets/x86\\\_64-linux.jsonandtargets/x86\\\_64-windows.json— first hosted target descriptors, validated in QA.[x]
targets/i386-elf.experimental.jsonandtargets/i386-pyramidos.experimental.json— planning descriptors only, not supported targets yet; QA keeps them experimental/freestanding. -
Structured process runtime — hosted Baa tools can launch direct argv with explicit cwd/environment/stdout/stderr, poll/wait/cancel, and collect exit status without shell text.
-
Hosted filesystem bridge — UTF-8 file opening plus guarded recursive mkdir/remove let Takween initialize and clean projects consistently on Windows and Linux.
-
Stable compiler invocation contract —
docs/TOOLING_CONTRACTS.mddocuments the flags Takween may rely on for check/compile/link/object/assembly workflows. -
Manifest compatibility —
docs/TOOLING_CONTRACTS.mdrecords deterministic fields Takween can consume from--emit-build-manifest. -
Include/dependency contract — canonical manifest dependencies and invalidation expectations are documented and covered by
tests/test_integration_artifacts.py. -
Exit-code contract — stable compiler exit statuses for build tools are implemented, documented in
docs/TOOLING_CONTRACTS.md, and covered by cross-platform QA. -
Machine-readable diagnostics plan —
docs/DIAGNOSTICS_JSON_SCHEMA.mddefines the future JSON diagnostics shape for Takween/Qalam. -
No internal Baa project build system — Baa keeps
baa build/baa run/baa cleanout ofcompiler-cli-v1; Takween owns Arabic-first project workflow UX. -
Stable target discovery —
--target-info=jsonemitstarget-info-v1with the host/selected targets, executable suffix, object format, and host-sensitive capabilities; focused runtime tests cover default and explicit target queries. -
Header/source convention —
docs/MODULES_AND_VISIBILITY.mdformalizes.baahdvs.baausage and is covered bytests/test_module_visibility_docs.py. -
Visibility modifiers — current public/default,
خارجي, andساكنrules for functions and globals are documented and guarded. -
Include-cycle diagnostics — cycle-chain diagnostics now include an Arabic help hint and focused negative-test coverage.
-
One-definition checks — multi-file link builds now reject duplicate exported function/global definitions before linker fallback diagnostics.
-
Header self-check mode —
--check-headerparses and semantically checks header declarations without emitting code. -
Migration guide —
docs/MODULES_AND_VISIBILITY.mdrecords the path from raw multi-file builds to Takween-managed builds. -
Fast check mode —
--checkparses and semantically checks sources without IR/codegen/toolchain output for editor feedback. -
Machine-readable diagnostics —
--diagnostics=jsonemitsdiagnostics-json-v1with file, line, column, span, code, severity, category, hints, and compiler-owned safe structured fixes for missing delimiters. -
Token dump mode —
--dump-tokens=jsonemitstokens-json-v1from the compiler-owned raw source scanner for saved or unsaved UTF-8 buffers, preserving comments, directives, literals, and exact byte spans while tolerating incomplete editor syntax. -
Structural editing ranges —
--dump-structure=jsonemits deterministicstructure-json-v1folding and selection candidates from the same tolerant raw scanner, excludes delimiter text inside comments and literals, and preserves partial ranges for incomplete editor buffers. -
Symbol outline mode —
--dump-symbols=jsonemitssymbols-json-v1for functions, parameters, globals, arrays, structs, unions, enums, fields, enum members, and type aliases with exact UTF-8 byte spans. -
Completion metadata export — keywords, builtins, included declarations, visible locals, and snippets in stable compiler-owned formats.
-
completion-data-json-v1exports lexer-owned keywords, directives, literals, primitive types, Arabic snippets, and canonical compiler builtin signatures through--completion-data=json. -
semantic-query-json-v1exports cursor-visible parameters, locals, globals, types, and explicitly included header declarations with lexical shadowing and future/sibling exclusion.
-
-
Cursor semantic query —
--semantic-query=json --position-byte=Nemitssemantic-query-json-v1with scope-correct hover declarations, active call signatures, exact definitions, and translation-unit references for saved or unsaved source, including included prototypes, shadowed locals, and temporary typing errors. -
Translation-unit semantic index —
--semantic-index=jsonemits compiler-bound structured identities and definition/declaration/reference occurrences so project-aware tools can fan out without identifier text matching. Identifier kinds distinguish functions, variables, parameters, fields, enum members, arrays, constants, and type declarations for compiler-owned editor coloring as well as navigation. -
Stable Windows editor paths — semantic query/index output preserves the exact
--source-stdinlogical root while resolved include and dependency paths expand 8.3 aliases to long Unicode paths. -
Canonical source formatting —
--format=jsonemits idempotentformat-json-v1for saved or unsaved UTF-8 buffers, preserves comments and literals, tolerates incomplete editing states, and keeps formatting policy in Baa rather than the IDE or LSP adapter. -
No internal Baa IDE roadmap —
docs/ECOSYSTEM_BOUNDARIES.mdkeeps Qalam-facing Baa work limited to compiler/data contracts while Qalam-IDE owns editor UI/UX. -
Coverage reporting — CI coverage for C compiler core.
-
Fuzz targets — lexer, parser, IR reader, include resolver.
-
Differential tests — compare
-O0vs-O2runtime output. -
Crash minimization workflow — reduce failing fuzz cases into committed regressions.
-
Backend stress tests — stack args, calls, structs, arrays, floats, and pointer-heavy programs.
-
Release dashboard — summarize pass/fail, coverage, fuzz corpus size, and determinism checks.
---
Goal: Improve generated-code trustworthiness and prevent silent regressions before the v0.9 beta freeze.
-
ABI test matrix — Windows x64 and SysV calls, returns, varargs, and stack args.
-
Struct/union layout tests — size, alignment, and field-offset expectations.
-
Floating-point ABI tests — parameters, returns, varargs edge cases.
-
Stack alignment verifier — static backend checks before emission.
-
Assembly golden tests — stable snippets for sensitive cases.
-
Cross-target
-Srelease gate — both Windows and Linux assembly output. -
Pass pipeline documentation — exact O0/O1/O2 pass order.
-
Per-pass verifier gate — mandatory in CI debug mode.
-
Optimization remarks — report applied and missed optimizations.
-
Alias-analysis baseline — conservative, documented, test-backed.
-
Optimization stress corpus — loops, branches, calls, pointers, and aggregate-heavy cases.
-
No unsafe optimization without verifier coverage — correctness first.
-
Benchmark baselines — compile time, runtime, and memory.
-
Regression thresholds — fail CI on large slowdowns.
-
Phase timing JSON — machine-readable
--time-phasesoutput. -
Memory budget tracking — IR arena, parser allocations, backend allocations.
-
Benchmark documentation — exact local reproduction commands.
-
Performance changelog entries — record meaningful wins and regressions.
---
Goal: Freeze a serious pre-1.0 baseline and define a future staged self-hosting plan without executing a production compiler rewrite in this roadmap window.
-
Language freeze candidate — syntax and semantics locked for 1.0 review.
-
Stdlib freeze candidate — ownership, errors, memory, text, file, and path APIs documented.
-
ABI freeze candidate — Windows/Linux behavior documented and tested.
-
Diagnostics freeze candidate — diagnostic IDs, spans, hints, and
--explainbehavior stable. -
External tooling contracts freeze — Takween/Qalam-facing outputs remain stable through 1.0 review.
-
Full release QA — Windows + Linux quick/full/stress/release gates.
-
Book + spec sync — all docs updated to v0.9.0.
-
Stage-0 bootstrap plan only — define future self-hosting stages, rollback, and parity gates; do not make self-hosting the mainline compiler yet.
-
Freestanding OS-dev profile plan only — define the future
i386-elf/i386-pyramidospath for PyramidOS experiments; do not move PyramidOS kernel core to Baa yet. -
**Compatibility matrix freeze** — Baa/Takween/Qalam contract versions are listed and stable through 1.0 review.
-
**Conformance suite v1 seed** — syntax, semantics, diagnostics, stdlib, ABI, and target tests define the stable-beta behavior.
---
Goal: Make Baa capable of compiling small freestanding objects for PyramidOS and OS-development experiments without pretending that the PyramidOS kernel can immediately move from C/Assembly to Baa.
-
Baa v0.9 is not an OS-dev-ready release by itself — v0.9 freezes the hosted language/toolchain baseline and only plans the freestanding path.
-
PyramidOS kernel core remains C + Assembly — bootloader, entry code, GDT/IDT/ISR, PMM/VMM, ATA, and panic paths stay in the current reference implementation until explicit gates pass.
-
Baa enters PyramidOS gradually — host tools first, then tiny mixed-link smoke objects, then userland, then carefully selected kernel leaf helpers.
-
No hidden hosted dependencies — freestanding Baa code must not silently call libc/CRT, file I/O, heap allocation, formatted I/O, or startup helpers.
-
Object/linker-script compatibility first — Baa must fit the PyramidOS linker script, section layout, symbols, and QEMU boot gate before any migration claim.
-
Rollback is mandatory — every Baa-in-PyramidOS experiment must be removable without breaking the C/Assembly kernel path.
Goal: Add a hosted-vs-freestanding compiler mode split.
-
--freestandingmode — compile with no hosted OS/runtime assumptions. -
--no-stdlibmode — reject or disable stdlib calls unless explicitly provided by the target. -
--kernelprofile alias — convenience mode for freestanding, no-stdlib, object-only defaults. -
Disable hosted builtins — no implicit lowering to libc/CRT for print, read, files, time, environment, or allocation.
-
Explicit runtime contract diagnostics — Arabic errors when hosted features are used in freestanding mode.
-
Arbitrary freestanding entry support — allow kernel/userland symbols other than the hosted Arabic
الرئيسية_بدءcontract. -
Object-only release gate — freestanding mode initially produces assembly/object outputs only, not hosted executables.
Goal: Add the target shape needed by the current 32-bit PyramidOS kernel.
-
--target=i386-elfbaseline — 32-bit x86 freestanding object/assembly output. -
Optional
--target=i386-pyramidosalias — PyramidOS-specific ABI/layout defaults once proven useful. -
32-bit data layout — pointer size, integer sizes, stack alignment, and aggregate layout documented and verified.
-
cdecl-style call ABI — stack arguments, return values, caller/callee-saved registers, and name decoration policy.
-
32-bit instruction selection — lower Baa IR to i386-compatible machine instructions.
-
32-bit register allocation — EAX/EBX/ECX/EDX/ESI/EDI/EBP/ESP constraints and spilling.
-
GAS/NASM compatibility decision — choose canonical emitted assembly syntax for PyramidOS builds.
-
Cross-toolchain integration — support
i686-elf/i386-elfassembler flow where available, without requiring hosted GCC linkage.Goal: Add the minimum low-level controls required for kernel code.
-
Volatile memory access — explicit volatile load/store for MMIO and hardware registers.
-
Packed structs — stable layout controls for descriptor tables and hardware data structures.
-
Alignment attributes — align variables/types/sections for page tables, stacks, and hardware structures.
-
Custom section attributes — place symbols in
.text,.rodata,.data,.bss, boot/kernel-specific sections. -
Compile-time layout assertions — verify
حجم, alignment, and field offsets for ABI-critical structures. -
Inline assembly hardening — tested patterns for
cli,sti,hlt,in,out,lgdt,lidt, and control-register access. -
Interrupt-wrapper contract — keep ISR/IRQ wrappers in Assembly first; only add Baa interrupt ABI support after wrapper tests pass.
Goal: Prove one tiny Baa object can link into and boot inside PyramidOS without touching critical paths.
-
Leaf Baa function object — compile a tiny non-critical Baa function to an object file.
-
C-callable ABI test — call the Baa function from C diagnostic code and verify arguments/return value.
-
Linker script compatibility — place Baa sections correctly in the PyramidOS image.
-
Symbol map verification — confirm symbols appear at expected addresses in
kernel.map. -
QEMU boot smoke — boot PyramidOS and run a diagnostic command that exercises the Baa function.
-
No critical subsystem migration — bootloader, GDT/IDT/ISR, PMM/VMM, heap, ATA, and VFS remain C/Assembly in this milestone.
-
Rollback test — removing the Baa object restores the exact C/Assembly-only build behavior.
Goal: Prefer Baa first for PyramidOS userland once Ring 3/syscalls exist.
-
Userland target profile — compile small Ring 3 Baa programs for PyramidOS when the OS ABI exists.
-
Syscall wrapper declarations —
.baahdheaders for stable PyramidOS syscalls. -
Minimal no-stdlib runtime — startup + syscall exit/write path only.
-
Userland hello program — Baa program prints via PyramidOS syscall, not host libc.
-
Userland ABI tests — argument passing, return codes, stack alignment, and failure behavior.
-
Separation policy — userland Baa can advance faster than kernel Baa because it is less boot-critical.
Goal: Try Baa inside the kernel only where failure risk is low and rollback is trivial.
-
Allowed migration list — small pure helpers only: string length, small formatting helpers, table lookup, diagnostics formatting.
-
Forbidden migration list — no bootloader, entry, GDT/IDT/ISR, PMM/VMM, heap allocator, ATA/PIO, scheduler, or panic core.
-
C reference parity tests — compare Baa helper behavior against existing C helpers.
-
No heap by default — kernel Baa code must not allocate unless PyramidOS exposes an explicit allocator contract.
-
No implicit panics — freestanding failure behavior must be explicit and kernel-safe.
-
QEMU regression gate — every helper migration must pass boot + shell + diagnostic smoke tests.
-
Rollback branch discipline — each helper migration lands as an isolated, revertable change.
-
Freestanding mode is real — no hidden libc/CRT dependency for accepted freestanding programs.
-
i386 target is proven — assembly/object output matches PyramidOS target expectations.
-
Layout controls are tested — packed/aligned/section features are verified with compile-time and binary checks.
-
Mixed-link gate passes — PyramidOS boots in QEMU with one C-called Baa object.
-
Userland path is defined — Baa has a cleaner first real OS role outside the kernel core.
-
Kernel migration remains gated — no critical subsystem is moved without separate design review and rollback plan.
---
Goal: retire the Windows ASCII staging bridge while preserving real Arabic/Unicode artifacts even when the selected GCC cannot open Unicode argv paths. Preserve the real compile/assemble/link phases, remove redundant filesystem copies, and keep compatibility behavior explicit.
-
Measured staging baseline — record assembly copy-in, object copy-out, link-input staging, runtime-archive staging, executable copy-out, tool execution, bytes copied, and multi-file amplification as separate metrics. The retired bridge cost
3N + 2copies and excluded all copy I/O from phase timers; the exact byte formula is versioned indocs/WINDOWS_TOOLCHAIN_PATHS.md. -
Windows toolchain capability matrix — prove Arabic assembly input, Arabic object output, Arabic object link input, Arabic executable output, Arabic-plus-space paths, long paths, multiple objects, UTF-8 response files, and the Arabic
الرئيسية_بدءentry symbol with the selected GCC/assembler/linker. Native Unicode argv and UTF-8 GCC response paths fail with MSYS2 GCC 15.2; no-copy short aliases to the same real artifacts pass the full matrix. -
Direct
-Soutput — emit assembly to the requested output path without an ASCII temporary file or copy, because this mode invokes no external assembler. -
Direct object destination — make the assembler write directly to the Baa/Takween-selected object or cache path. The selected GNU assembler cannot write an object to stdout, so Windows uses a no-copy alias to the real object.
-
Direct linking — pass the real object/runtime entities to GCC/LD and write the executable directly to the requested destination through the same no-copy path adapter.
-
Explicit incompatibility — an arbitrary toolchain that fails the Unicode capability contract returns a stable external-toolchain error; no silent normal-path staging fallback may hide the limitation. A missing filesystem alias is an explicit status-4 failure.
-
Remove staging implementation — delete the ASCII staging directory, copy-in/copy-out helpers, and redundant cleanup once direct mode is the admitted Windows path. Temporary artifact and linker-response names include the process identity to eliminate cross-process collisions.
-
Ecosystem gates — Arabic-path, spaces, a Windows path beyond 260 UTF-16 units, multi-file, concurrent-build, phase-timing, and determinism coverage passes in Baa CI
29685512987and exact admission29687846586; Takween cache/build/run/clean/test passes on Windows/Linux in29689709002.Ordering: complete the current Nazm production-admission gate first, then land this direct artifact pipeline before Takween 0.4's content-addressed cache and workspace expansion, so Takween can select final object/cache destinations without Baa copying them through an internal staging tree.
---
Goal: replace the external GAS/MASM assembly boundary with the independently tested Nazm assembler without duplicating its parser, encoder, or object writers inside Baa.
-
Boundary contract — freeze
baa-nazm-boundary-v0ownership, text, target, diagnostics, and source-map behavior. -
Coverage inventory — extract every instruction, operand, directive, section, symbol, and relocation form emitted by the Windows/Linux corpus.
-
Arabic emitter — emit canonical Nazm 0.4 text after register allocation while retaining inspectable
-Soutput.- First executable slice:
--emit-nazmemits an Arabic-only minimal integer entry for Windows/Linux targets and visibly rejects every unsupported form. - PC-relative global slice: scalar global loads/stores and function/global addresses emit
[مؤشر_التعليمة+الرمز]; immediate stores lower through a scratch register and duplicate extern-plus-definition declarations emit one definition. - Memory arithmetic slice:
imulaccepts base/displacement memory sources and spilledsetccdestinations emit the native Arabic memory form. - Scalar-decimal slice: all 16 XMM identities emit only as
سجل_عشري_٠throughسجل_عشري_١٥; arithmetic, comparison, bit transport, and integer/decimal conversions assemble to ELF64 and COFF with no Latin source aliases. - Arabic fixture and spill-width slice: include-path fixtures use Arabic-only function identities, 32-bit PC-relative globals zero-extend through a 32-bit destination view, and spilled unary bitwise-NOT lowers through a spill-safe scratch register.
- Conversion-configuration slice:
--startup=customremains a GAS-Spresentation option and no longer blocks or duplicates canonical Nazm emission; stack protection retains its own stable blocker contract. - Debug-information slice:
--debug-infoemits Arabic-only.ملف_بايتات/.موضعdirectives, which Nazm lowers to DWARF v4 line tables in ELF64 and CodeView C13 line tables in COFF.
- First executable slice:
-
Shadow integration — invoke Nazm without changing the production GAS result and compare object/link/runtime semantics.
- First executable slice:
--nazm-shadow=<path>assembles and links a one-input minimal program beside GAS with visible no-fallback failures and host runtime parity coverage.
- First executable slice:
-
Guarded embedding —
nazm-api-v1freezes owned result/diagnostic lifetimes and OOM/error status; Baa can callnazm_assemble_buffer()only in an explicitly enabled build and only after--نظم-داخل-العملية, while the subprocess remains the production default. -
Generated-form corpus — version
baa-nazm-coverage-v1from the full 100-source, two-target inventory and assemble focused ELF64/COFF fixtures for every currently supported form; partial and unsupported forms remain explicit. -
Source-level shadow matrix — classify all 100 sources on both targets as Arabic-only emitted, visibly unsupported, or gate error; every rejection carries a stable Arabic blocker kind/detail. Structured architecture operations and target-specific debug line tables now admit all 100 sources on each target with zero unsupported rows and zero gate errors.
-
Source mapping —
baa-nazm-source-map-v1binds generated Nazm line ranges to the original UTF-8 Baa file/line/column, and shadow assembler failures replay the Nazm diagnostic plus its mapped Baa location on Windows/Linux. -
Inline assembly migration contract — version the breaking move away from raw
مجمع { ... }GAS text: common in-function operations become typed Arabic Baa intrinsics backed by Machine IR, while arbitrary assembly lives in first-class.نظمmodules. -
Inline assembly migration implementation — Nazm encodes
اقرأ_عداد_الزمن; Baa exposes typedلا_تفعل()andاقرأ_عداد_الزمن()operations backed by structured IR/Machine IR and lowers them to GAS and canonical Arabic Nazm; Takween compiles mixed.baa/.نظمroots; rawمجمعnow returns an Arabic source-migration error. A future inlineنظم { ... }extension remains optional and must use explicit inputs/outputs/clobbers without embedding or translating GAS text. -
Target contract — map Baa targets explicitly to Nazm ELF64/COFF modes.
-
Opt-in shadow flag — assemble with Nazm beside the production GAS path.
-
Object comparison — compare sections, symbols, relocations, and normalized semantics rather than requiring incidental byte identity for every admitted source.
-
Linux PIC/PIE producer parity — default Nazm and explicit GAS compile the string/global/runtime-call fixture under
-fPICand-fPIE; normalized initialized/read-only sections, public symbols, and relocation presence agree, and the Nazm-default-fPIEpath links anET_DYNexecutable with identical runtime behavior in Baa CI run29679921655. -
Link/runtime comparison — link and run both outputs on Windows and Linux for every admitted source.
-
Arabic linker entry — preserve
الرئيسيةin Nazm ELF64/COFF objects and enter both hosted shadow targets throughالرئيسية_بدءwithout amainalias or direct-function process entry. -
Arabic production ABI — both assemblers emit
الرئيسيةunchanged, link throughالرئيسية_بدء, and convert Windows UTF-16 argv throughبدء_ويندوزwithoutmain/wmainaliases; Nazm is now the production default. -
Arabic shadow startup ABI — Linux reuses the generated
الرئيسية_بدءobject and returns through__libc_start_main; Windows resolves the same strong Arabic entry through a linker-owned UTF-8 response file and dispatches toبدء_ويندوز. -
Diagnostics comparison — unsupported forms remain visible Arabic failures.
-
No silent fallback — never substitute guessed bytes or hide unsupported Nazm input behind GAS.
-
Full gate — quick, full, stress, determinism, release, and cross-target suites pass through Nazm.
- Windows release receipt — the complete 75-step release orchestrator passes with the 100-source normal/shadow gate and deterministic Nazm source/object/manifest receipt enabled.
- Linux release receipt — exact Baa
661edd9...and Nazm7236491...pass 75/75 release steps on hosted Linux in admission run29687846586. - Exact-revision hosted ladder — the read-only
Baa Nazm Production Admissionworkflow requires and verifies full Baa and Nazm commit SHAs, builds both projects, runs quick/full/stress/release on Windows/Linux with explicitBAA/NAZMbindings, and retains revision plus QA receipts.
-
Linker acceptance — real Windows and Linux linkers accept produced objects.
-
Normal assembler selection —
--assembler=nazmresolves the executable from--nazm-path,BAA_NAZM, or the primary Arabicنظمcommand onPATH, emits/assembles canonical Arabic source directly to the selected object, and passes it to the normal linker;--assembler=gasremains the explicit measured migration rollback with no silent fallback.- 100-source normal-path gate — every admitted host corpus source also builds through
--assembler=nazm; runnable programs match the GAS result in exit status, stdout, and stderr on Windows and Linux in exact-SHA hosted CI. - Deterministic generated-source identity — keep process-unique physical
.نظمintermediates for concurrency, but pass the stable Arabicباء-مولد.نظمidentity to Nazm; repeated canonical source, object, and build-manifest outputs are byte-identical.
- 100-source normal-path gate — every admitted host corpus source also builds through
-
Mixed Baa/Nazm roots — direct
.نظمroots bypass Baa parsing, assemble through the same resolved Nazm CLI, record per-unit source/assembler receipts, and join.baaobjects in one hosted Arabic-ABI link; source/tool failures remain distinct and never fall back to GAS. -
Default-on readiness — approved parity report and rollback procedure exist; Nazm is the production default and GAS is the explicit rollback.
- Automated production admission — exact candidate revisions pass quick/full/stress/release on Windows and Linux with 27/27, 44/44, 74/74, and 75/75 receipts respectively.
- Decision record approved —
docs/NAZM_PRODUCTION_ADMISSION.mdrecords Baa661edd9..., Nazm7236491..., Takweenda8378e..., terminal runs29685356936,29685512987,29687846586,29689709002, the explicit GAS rollback drill, and all three owner approvals. - Default cutover — omitted assembler selection now chooses Nazm;
--assembler=gasis the only normal rollback, and failures never trigger it automatically.
-
In-process equivalence — the Nazm CLI and
nazm-api-v1path produce byte-identical ELF64/COFF objects and matching primary failures; the exact API/version/capability fingerprint is recorded in manifests and cache keys before generated or direct Nazm objects are reused. Default in-process cutover remains a separate future admission decision.---
Goal: Remove dependency on external linker (ld/link.exe).
-
Object ingestion layer — robust COFF/ELF readers with strict validation.
-
Link graph core — symbol table, section graph, relocation plan, address assignment.
-
Format writers — PE/ELF executable writers with deterministic layout rules.
-
Runtime bridge layer — controlled integration with CRT/system runtime requirements.
-
Verification layer — parity checks vs system linkers + deterministic output checks.
-
Deterministic link ordering — stable output independent of host filesystem ordering.
-
No silent symbol resolution — ambiguous/duplicate/undefined symbols must emit explicit diagnostics.
-
Relocation correctness first — overflow and invalid relocation types are hard failures.
-
Target isolation — Windows and Linux paths share abstractions, not target-specific hacks.
-
Parse object files — Read COFF/ELF format.
-
Symbol resolution — Match symbol references to definitions.
-
Section merging — Combine sections from multiple objects.
-
Memory layout — Assign virtual addresses to sections.
-
Archive scanning strategy — deterministic one-pass/two-pass policy for
.a/.lib. -
Input validation policy — reject malformed object metadata with Arabic diagnostics.
-
Apply relocations — Fix up addresses in code/data.
-
Handle relocation types — PC-relative, absolute, GOT, PLT.
-
Overflow detection — Check address range limits.
-
Relocation test matrix — per-target coverage for required relocation kinds.
-
Late-binding audit logs — debug trace mode for relocation decisions.
-
PE header — DOS stub, PE signature, file header.
-
Optional header — Entry point, section alignment, subsystem.
-
Section headers — .text, .data, .rdata, .bss.
-
Import table — For C runtime and Windows API.
-
Export table — If building DLLs (future).
-
Generate .exe — Complete Windows executable.
-
PE conformance checks — verify headers/alignments with tooling (
dumpbin/llvm-readobj). -
Subsystem policies — console/gui/custom-startup rules documented and tested.
-
ELF header — File identification, entry point.
-
Program headers — Loadable segments.
-
Section headers — .text, .data, .rodata, .bss.
-
Dynamic linking info — For libc linkage.
-
Generate executable — Complete Linux binary.
-
ELF conformance checks — validate segments/sections with
readelf/objdump. -
PIE/non-PIE policy — deterministic handling for code model and relocation mode.
-
Static libraries — Link .a/.lib archives.
-
Library search paths —
-Lflag support. -
Entry point selection — Custom entry point support.
-
Strip symbols — Remove debug symbols for release.
-
Map file — Generate link map for debugging.
-
Section GC plan — optional dead-section elimination with safety checks.
-
Weak symbol semantics — explicit target-specific behavior for weak/strong bindings.
-
Replace ld/link calls — Use internal linker.
-
--use-internal-linkerflag — Optional internal linker. -
Verify output — Compare with system linker output.
-
End-to-end test — Compile and link without external tools.
-
Dual-link CI mode — run internal and system linker paths on same corpus.
-
Fallback policy — controlled fallback with reasoned diagnostics when unsupported.
-
Cross-target parity signoff — runtime and symbol behavior match system linker expectations.
-
Determinism signoff — stable binary layout for identical inputs/toolchains.
-
Stress signoff — large multi-object links and archive-heavy workloads remain stable.
-
Default-on readiness — internal linker can be default for supported targets.
-
Regression stability — quick/full/stress QA pass with internal linker enabled.
-
Debuggability baseline — diagnostics + map output sufficient for failure triage.
---
Goal: Zero external dependencies — Baa builds itself with no external tools.
-
Runtime kernel layer — startup, syscall/API bridge, memory primitives, and process exit flow.
-
Native stdlib layer — string/math/memory/io modules implemented in Baa with stable ABI contracts.
-
Bootstrap provenance layer — staged compiler lineage (
baa0 -> baa1 -> baa2) with hashable artifacts. -
Hermetic build layer — controlled inputs, pinned flags, deterministic packaging outputs.
-
Operational verification layer — dependency scans, runtime smoke tests, and cross-target release gates.
-
No hidden host dependencies — any required host tool must be explicitly listed in bootstrap docs.
-
Reproducibility-first policy — build determinism regressions block release.
-
Cross-target parity policy — Windows/Linux runtime features must ship together or stay gated.
-
Fail-fast runtime diagnostics — startup/syscall/runtime failures must emit explicit Arabic-first errors.
-
Recovery-path requirement — each independence milestone must define rollback and re-bootstrap steps.
Windows:
-
Direct Windows API calls — Replace printf with WriteConsoleA.
-
Implement
اطبعnatively — Direct syscall/API. -
Implement
اقرأnatively — ReadConsoleA. -
Implement memory functions — HeapAlloc/HeapFree instead of malloc/free.
-
Implement file I/O — CreateFile, ReadFile, WriteFile.
-
Custom entry point — Replace C runtime startup.
-
SEH-aware startup — preserve stable crash/exit semantics without CRT helpers.
-
Win64 ABI compliance checks — stack alignment, shadow space, and return path verified.
Linux:
-
Direct syscalls — write, read, mmap, exit.
-
Implement
اطبعnatively — syscall to write(1, ...). -
Implement
اقرأnatively — syscall to read(0, ...). -
Implement memory functions — mmap/munmap for allocation.
-
Implement file I/O — open, read, write, close syscalls.
-
Custom _start — No libc dependency.
-
Syscall ABI validation — register/stack contracts verified on x86_64 SystemV.
-
Signal/exit behavior checks — deterministic termination semantics across test corpus.
-
Rewrite string functions in Baa — No C dependency.
-
Rewrite math functions in Baa — Pure Baa implementation.
-
Rewrite memory functions in Baa — Custom allocator.
-
Full standard library in Baa — All library code in Baa.
-
Module boundary contracts — document stable APIs for
core,memory,string,math,io. -
Behavioral parity suite — compare stdlib behavior vs prior runtime expectations.
-
Allocator policy gates — fragmentation/throughput baselines for long-running workloads.
-
Single binary compiler — No external dependencies.
-
Cross-compilation support — Build Linux binary on Windows and vice versa.
-
Reproducible builds — Same source → identical binary.
-
Bootstrap from source — Document minimal bootstrap path.
-
Hermetic manifest — lock source inputs, flags, and artifact metadata per release.
-
Stage replay tooling — deterministic scripts to replay bootstrap on clean machines.
-
Provenance hashing — publish hashes for each stage artifact and final binaries.
-
Full test suite passes — All tests without external tools.
-
Benchmark comparison — Performance vs GCC toolchain.
-
Security audit — Review for vulnerabilities.
-
Documentation complete — Full toolchain documentation.
-
Release v3.0.0 — Fully independent Baa! 🎉
-
Supply-chain audit — verify release pipeline does not reintroduce external tool reliance.
-
Disaster-recovery drill — validate clean-room bootstrap from tagged sources.
-
Zero-dependency signoff — compile/assemble/link/run path requires only Baa-delivered artifacts.
-
Deterministic bootstrap signoff — repeated stage builds are byte-stable per target.
-
Cross-target signoff — Windows + Linux release candidates pass identical gate checklist.
-
Operational signoff — upgrade/rollback/bootstrap recovery procedures validated and documented.
-
Runtime independence — no libc/CRT dependency in default build+run workflow.
-
Toolchain independence — compiler, assembler, linker, and runtime are owned by the Baa ecosystem with explicit repository boundaries.
-
Reproducibility baseline — release artifacts are verifiable and reproducible from source.
-
Sustainability baseline — maintenance docs and on-call triage playbooks are complete.
┌────────────────────────────────────────────────────────────────┐ │ Baa Toolchain Evolution │ ├────────────────────────────────────────────────────────────────┤ │ │ │ v0.2.x (Current): │ │ ┌─────────┐ ┌───────────────────────────────────────────┐ │ │ │ Baa │ → │ GCC (assembler + linker + C runtime) │ │ │ │ Compiler│ │ │ │ │ └─────────┘ └───────────────────────────────────────────┘ │ │ │ │ v0.9.x (Stable Beta): │ │ ┌─────────┐ ┌───────────────────────────────────────────┐ │ │ │ Baa │ → │ GCC (assembler + linker + C runtime) │ │ │ │ C ref │ │ + future staged bootstrap plan only │ │ │ └─────────┘ └───────────────────────────────────────────┘ │ │ │ │ v1.5.0 (Nazm Assembler): │ │ ┌─────────┐ ┌─────────┐ ┌─────────────────────────────┐ │ │ │ Baa │ → │ Nazm │ → │ GCC (linker + C runtime) │ │ │ │ Compiler│ │Assembler│ │ │ │ │ └─────────┘ └─────────┘ └─────────────────────────────┘ │ │ │ │ v2.0.0 (Own Linker): │ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌───────────────┐ │ │ │ Baa │ → │ Nazm │ → │ Linker │ → │ C Runtime │ │ │ │ Compiler│ │Assembler│ │ (future)│ │ (printf etc) │ │ │ └─────────┘ └─────────┘ └─────────┘ └───────────────┘ │ │ │ │ v3.0.0 (Full Independence): │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ Baa Ecosystem Toolchain (independently owned) │ │ │ │ Compiler → Assembler → Linker → Native Runtime │ │ │ │ │ │ │ │ No External Dependencies! │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ └────────────────────────────────────────────────────────────────┘
\---
## 🏗️ Phase 2: Architecture Overhaul - Completed
<details>
<summary><strong>v0.2.0</strong> — The Driver (CLI \& Build System)</summary>
* \[x] **CLI Argument Parser** — Implement a custom argument parser to handle flags manually.
* \[x] **Input/Output Control** (`-o`, `-S`, `-c`).
* \[x] **Information Flags** (`--version`, `--help`, `-v`).
* \[x] **Build Pipeline** — Orchestrate Lexer -> Parser -> Codegen -> GCC.
</details>
<details>
<summary><strong>v0.2.1</strong> — Polish \& Branding</summary>
* \[x] **Executable Icon** — Embed `.ico` resource.
* \[x] **Metadata** — Version info, Copyright, Description in `.exe`.
</details>
<details>
<summary><strong>v0.2.2</strong> — The Diagnostic Engine Patch</summary>
* \[x] **Source Tracking** — Update `Token` and `Node` to store Filename, Line, and Column.
* \[x] **Error Module** — Create a dedicated error reporting system.
* \[x] **Pretty Printing** — Display errors with context (`^` pointers).
* \[x] **Panic Recovery** — Continue parsing after errors.
</details>
<details>
<summary><strong>v0.2.3</strong> Distribution \& Updater Patch</summary>
* \[x] **Windows Installer** — Create `setup.exe` using Inno Setup.
* \[x] **PATH Integration** — Add compiler to system environment variables.
* \[x] **Self-Updater** — Implement `baa update` command.
</details>
<details>
<summary><strong>v0.2.4</strong> The Semantic Pass (Type Checker)</summary>
* \[x] **File Extension Migration** — Change `.b` to `.baa`. Reserved `.baahd` for headers.
* \[x] **Pass Separation** — Completely separate Parsing from Code Generation.
* `parse()` returns a raw AST.
* `analyze()` walks the AST to check types and resolve symbols.
* The backend pipeline consumes a validated AST.
* \[x] **Symbol Resolution** — Check for undefined variables before code generation starts.
* \[x] **Scope Analysis** — Implement scope stack to properly handle nested blocks and variable shadowing.
* \[x] **Type Checking** — Validate assignments (int = string now fails during semantic analysis).
</details>
<details>
<summary><strong>v0.2.5</strong> Multi-File \& Include System</summary>
* \[x] **File Extension Migration** — Change `.b` to `.baa`. Reserved `.baahd` for headers.
* \[x] **Include Directive** — `#تضمين "file.baahd"` (C-style `#include`).
* \[x] **Header Files** — `.baahd` extension for declarations (function signatures, extern variables).
* \[x] **Function Prototypes** — Declarations without types `صحيح دالة().` (Added).
* \[x] **Multi-file CLI** — Accept multiple inputs: `baa main.baa lib.baa -o out.exe`.
* \[x] **Linker Integration** — Compile each file to `.o` then link together.
</details>
<details>
<summary><strong>v0.2.6</strong> Preprocessor Directives</summary>
* \[x] **Define** — `#تعريف اسم قيمة` for compile-time constants.
* \[x] **Conditional** — `#إذا\_عرف`, `#إذا\_عرف`, `#إذا\_لم\_يعرف`, `#وإلا`, `#وإلا\_إذا`, `#نهاية\_إذا` for conditional compilation.
* \[x] **Undefine** — `#الغاء\_تعريف` to remove definitions.
</details>
<details>
<summary><strong>v0.2.7</strong> Constants \& Immutability</summary>
* \[x] **Constant Keyword** — `ثابت` for immutable variables: `ثابت صحيح حد = ١٠٠.`
* \[x] **Const Checking** — Semantic error on reassignment of constants.
* \[x] **Array Constants** — Support constant arrays.
</details>
<details>
<summary><strong>v0.2.8</strong> Warnings \& Diagnostics</summary>
* \[x] **Warning System** — Separate warnings from errors (non-fatal).
* \[x] **Unused Variables** — Warn if variable declared but never used.
* \[x] **Dead Code** — Warn about code after `إرجع` or `توقف`.
* \[x] **`-W` Flags** — `-Wall`, `-Werror` to control warning behavior.
</details>
<details>
<summary><strong>v0.2.9</strong> — Input \& UX Polish</summary>
* \[x] **Input Statement** — `اقرأ س.` (scanf) for reading user input.
* \[x] **Boolean Type** — `منطقي` type with `صواب`/`خطأ` literals.
* \[x] **Colored Output** — ANSI colors for errors (red), warnings (yellow). *(Implemented in v0.2.8)*
* \[x] **Compile Timing** — Show compilation time with `-v`.
</details>
## 📦 Phase 1: Language Foundation (v0.1.x) - Completed
<details>
<summary><strong>v0.1.3</strong> — Control Flow \& Optimizations</summary>
* \[x] **Extended If** — Support `وإلا` (Else) and `وإلا إذا` (Else If) blocks.
* \[x] **Switch Statement** — `اختر` (Switch), `حالة` (Case), `افتراضي` (Default)
* \[x] **Constant Folding** — Compile-time math (`١ + ٢` → `٣`)
</details>
<details>
<summary><strong>v0.1.2</strong> — Recursion \& Strings</summary>
* \[x] **Recursion** — Stack alignment fix
* \[x] **String Variables** — `نص` type
* \[x] **Loop Control** — `توقف` (Break) \& `استمر` (Continue)
</details>
<details>
<summary><strong>v0.1.1</strong> — Structured Data</summary>
* \[x] **Arrays** — Fixed-size stack arrays (`صحيح قائمة\[١٠]`)
* \[x] **For Loop** — `لكل (..؛..؛..)` syntax
* \[x] **Logic Operators** — `\&\&`, `||`, `!` with short-circuiting
* \[x] **Postfix Operators** — `++`, `--`
</details>
<details>
<summary><strong>v0.1.0</strong> — Text \& Unary</summary>
* \[x] **Strings** — String literal support (`"..."`)
* \[x] **Characters** — Character literals (`'...'`)
* \[x] **Printing** — Updated `اطبع` to handle multiple types
* \[x] **Negative Numbers** — Unary minus support
</details>
<details>
<summary><strong>v0.0.9</strong> — Advanced Math</summary>
* \[x] **Math** — Multiplication, Division, Modulo
* \[x] **Comparisons** — Greater/Less than logic (`<`, `>`, `<=`, `>=`)
* \[x] **Parser** — Operator Precedence Climbing (PEMDAS)
</details>
<details>
<summary><strong>v0.0.8</strong> — Functions</summary>
* \[x] **Functions** — Function definitions and calls
* \[x] **Entry Point** — Mandatory `الرئيسية` exported unchanged with an Arabic-only hosted startup ABI
* \[x] **Scoping** — Global vs Local variables
* \[x] **Windows x64 ABI** — Register passing, stack alignment, shadow space
</details>
<details>
<summary><strong>v0.0.7</strong> — Loops</summary>
* \[x] **While Loop** — `طالما` implementation
* \[x] **Assignments** — Update existing variables
</details>
<details>
<summary><strong>v0.0.6</strong> — Control Flow</summary>
* \[x] **If Statement** — `إذا` with blocks
* \[x] **Comparisons** — `==`, `!=`
* \[x] **Documentation** — Comprehensive Internals \& API docs
</details>
<details>
<summary><strong>v0.0.5</strong> — Type System</summary>
* \[x] Renamed `رقم` to `صحيح` (int)
* \[x] Single line comments (`//`)
</details>
<details>
<summary><strong>v0.0.4</strong> — Variables</summary>
* \[x] Variable declarations and stack offsets
* \[x] Basic symbol table
</details>
<details>
<summary><strong>v0.0.3</strong> — I/O</summary>
* \[x] `اطبع` (Print) via Windows `printf`
* \[x] Multiple statements support
</details>
<details>
<summary><strong>v0.0.2</strong> — Math</summary>
* \[x] Arabic numerals (٠-٩)
* \[x] Addition and subtraction
</details>
<details>
<summary><strong>v0.0.1</strong> — Foundation</summary>
* \[x] Basic pipeline: Lexer → Parser → Codegen → GCC
</details>
\---
## 📊 Timeline Summary
|Phase|Version|Milestone|Dependencies / Owner|
|-|-|-|-|
|Phase 3|v0.3.x|IR Complete|GCC|
|Phase 3.5|v0.3.3-v0.3.12|Language Complete|GCC|
|Phase 4|v0.4.x|Standard Library|GCC|
|Phase 4.5|v0.5.x|Reference Compiler Stabilization|GCC|
|Phase 6|v0.6.x|Language Usability \& Safety|Baa compiler|
|Phase 7|v0.7.x|Testing \& External Integration Contracts|Baa + Takween/Qalam contracts|
|Phase 8|v0.8.x|Backend/Optimizer/Performance Reliability|Baa compiler|
|Phase 9|v0.9.x|Stable Beta + Future Bootstrap/OS-dev Plan|Baa compiler|
|Future|v0.10.x / post-v0.9|Freestanding OS Development Profile|Baa compiler + PyramidOS C/ASM reference|
|Future|post-v0.10|Self-hosting / own assembler / own linker|Separate staged decision|
\---
*For detailed changes, see the* [*Changelog*](CHANGELOG.md)