SakuraE/
├── CMakeLists.txt # CMake build configuration file
├── main.cpp # Main entry point of the compiler
├── 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
│ │ ├── generator.cpp # IR generator implementation (AST visitor)
│ │ ├── generator.hpp # IR generation utilities
│ │ ├── IR.hpp # Core IR definitions
│ │ ├── 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
├── includes/ # External dependencies
│ ├── magic_enum.hpp # Enum reflection library
│ └── String.hpp # Custom string utilities
└── README.md # This file
- 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).
-
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
-
Run the compiler (optional test):
./SakuraE ../demo.sak
If you encounter issues, ensure LLVM development libraries are installed (e.g., llvm-dev package) and llvm-config is available in PATH.
For more detailed development specifications regarding the IR, please click the link below.
- The Flysong : Contributor inspired by the Parser
- SendsTeam : Provide LLM Service during developing
