README.md
February 15, 2026 ยท View on GitHub
Based on LLVM, A Compilable Programming Language
TODO List
Project Structure (Main)
Warning
This part was generated by AI
SakuraE/
โโโ CMakeLists.txt # CMake build configuration file
โโโ main.cpp # Main entry point of the compiler
โโโ atrI/ # Interactive CLI and configuration management
โ โโโ atrI.hpp # Main header for atrI
โ โโโ commands.hpp # CLI command definitions
โ โโโ README.md # atrI documentation
โ โโโ utils.hpp # Utility functions for CLI
โ โโโ config/ # Configuration management
โ โโโ config.hpp # Configuration definitions
โโโ Compiler/ # Core compiler components
โ โโโ Error/ # Error handling utilities
โ โ โโโ error.hpp # Error definitions and handling
โ โโโ Frontend/ # Frontend components (lexer, parser, AST)
โ โ โโโ AST.hpp # Abstract Syntax Tree definitions
โ โ โโโ grammar.txt # Grammar rules for parsing
โ โ โโโ lexer.cpp # Lexical analyzer implementation
โ โ โโโ lexer.h # Lexer header
โ โ โโโ parser_base.hpp # Base parser utilities and parser combinators
โ โ โโโ parser.cpp # Parser implementation
โ โ โโโ parser.hpp # Parser header
โ โโโ IR/ # Intermediate Representation (IR) module
โ โ โโโ docs/ # IR documentation and specifications
โ โ โโโ generator.cpp # IR generator implementation (AST visitor)
โ โ โโโ generator.hpp # IR generation utilities
โ โ โโโ README-zh_cn.md # IR documentation (Chinese)
โ โ โโโ README.md # IR documentation (English)
โ โ โโโ struct/ # IR structural components
โ โ โ โโโ block.hpp # Basic block representation
โ โ โ โโโ function.hpp # Function representation with scope management
โ โ โ โโโ instruction.hpp # Instruction definitions and OpKind enum
โ โ โ โโโ module.hpp # Module representation
โ โ โ โโโ program.hpp # Program-level IR
โ โ โ โโโ scope.hpp # Scope management for symbols
โ โ โโโ type/ # Type system
โ โ โ โโโ type.cpp # IRType implementation
โ โ โ โโโ type.hpp # IRType definitions (int, float, array, pointer, etc.)
โ โ โ โโโ type_info.cpp # TypeInfo implementation
โ โ โ โโโ type_info.hpp # TypeInfo for frontend type representation
โ โ โโโ value/ # Value and constant systems
โ โ โโโ constant.cpp # Constant value implementation
โ โ โโโ constant.hpp # Constant value definitions
โ โ โโโ value.hpp # Value representations
โ โโโ LLVMCodegen/ # LLVM Backend Codegen module
โ โ โโโ LLVMCodegenerator.cpp # Implementation of sakIR to LLVM IR conversion
โ โ โโโ LLVMCodegenerator.hpp # LLVM Codegen definitions and state management
โ โโโ Utils/ # Utility functions
โ โโโ Logger.hpp # Logging utilities
โโโ Runtime/ # Runtime Library
โ โโโ alloc.cpp # Memory allocator implementation
โ โโโ alloc.h # Allocator header
โ โโโ gc.cpp # Garbage Collector implementation
โ โโโ gc.h # GC header
โ โโโ print.cpp # Basic I/O implementation
โ โโโ print.h # I/O header
โ โโโ raw_string.cpp # String manipulation implementation
โ โโโ raw_string.h # String utility header
โ โโโ README-zh_cn.md # Runtime documentation (Chinese)
โ โโโ README.md # Runtime documentation (English)
โโโ includes/ # External dependencies
โ โโโ magic_enum.hpp # Enum reflection library
โ โโโ String.hpp # Custom string utilities
โโโ sakurae-vsc/ # VSCode Extension
โ โโโ language-configuration.json # Language configuration
โ โโโ package.json # Extension manifest
โ โโโ README.md # Extension documentation
โ โโโ syntaxes/ # Syntax highlighting
โ โโโ sak.tmLanguage.json # TextMate grammar for SakuraE
โโโ test/ # Test cases
โ โโโ test0.sak # Sample SakuraE source files
โโโ tools/ # Helper tools
โ โโโ line.py # Line counting utility
โโโ README.md # This file
Build
Prerequisites
- C++ Compiler: GCC 13+ or Clang 16+ supporting C++23 (as specified in CMakeLists.txt).
- CMake: Version 3.24 or higher.
- LLVM: Version 16+ installed and configured (required for the project, as it uses LLVM libraries).
- Ninja: Version 1.13.2
Build Steps
-
Clone the repository:
git clone https://github.com/powerangelxd/SakuraE.git cd SakuraE -
Create build directory:
mkdir build cd build -
Configure with CMake:
cmake -G Ninja ..This will detect LLVM and set up the build with C++23 standard and necessary flags using Ninja.
-
Build the project:
ninja -
Create a
.sakfile in folder buildtouch test.sakThen write this program for test:
echo "func fib(n: i32) -> i32 { if (n <= 1) { return n; } return fib(n - 1) + fib(n - 2); } func main() -> i32 { __println(\"Hello world, check fib(21):\"); return fib(21); }" >> test.sak -
Run the compiler (optional test):
./SakuraE
If you encounter issues, ensure LLVM development libraries are installed (e.g., llvm-dev package) and llvm-config is available in PATH.
IR Developing
For more detailed development specifications regarding the IR, please click the link below.
Runtime Library
If you want to know something about SakuraE Runtime Library, Click the link:
Contributor
- The Flysong : Contributor inspired by the Parser
Sponsor
- SendsTeam : Provide LLM Service during developing