Welcome to the Bling Compiler โ a powerful toolchain designed to translate Bling source code into optimized Apple Silicon (ARM64) assembly. This compiler is thoughtfully architected and built from the ground up, encompassing three key phases: lexical analysis, parsing, and code generation.
The Bling language is minimalist yet expressive, supporting core constructs for computation. Here's a snippet that generates a Fibonacci-like sequence:
int x = 0;
int y = 1;
int z = 0;
int i = 1;
while(i neq 100){
x = y;
y = z;
z = y + x;
i = i + 1;
}
exit(x);
-
๐ Lexical Analyzer (Lexer):
Converts.blingsource files into a stream of tokens โ recognizing keywords, identifiers, operators, separators, and literals. -
๐ฒ Parser:
Builds an Abstract Syntax Tree (AST) from the token stream, capturing the structural and syntactic essence of the code. -
โ๏ธ Code Generator (in progress):
Traverses the AST to produce ARM64 assembly instructions, specifically optimized for Apple Silicon.
A Makefile is included to simplify building and running the compiler.
Ensure you have the following installed:
- ๐งฐ A C compiler (
gccorclang) - ๐ฆ
makeutility
make compTo compile a Bling source file:
make run FILE=<your_file.bling>If no
FILEis specified, it defaults totest.bling.
make cleanRemoves all build artifacts and binaries.
.
โโโ main.c # Entry point
โโโ lexer.{h,c} # Lexical analyzer
โโโ parser.{h,c} # AST builder
โโโ codegenerator.{h,c} # ARM64 code generator (in progress)
โโโ utils/ # Hashmaps and reusable components
โโโ assembly/ # Apple Silicon assembly tests/resources
โโโ test.bling # Sample Bling code
โโโ Makefile # Build automation-
๐งฌ Full ARM64 Code Generation:
Finalize and polish the code generator for complete ARM64 coverage. -
๐งต Richer Language Support:
Add strings, floats, and other primitive types. -
๐ง Advanced Control Flow:
Support forif,else, nested loops, and user-defined functions. -
๐ก Robust Error Handling:
Improve diagnostic messages and recovery mechanisms. -
๐งช Automated Testing Suite:
Ensure correctness and performance of all components โ especially ARM64 output.
This project is open-source and available under the terms of the LICENSE.md file.