Skip to content

SakuraE is a simple, compiled language based on LLVM.

Notifications You must be signed in to change notification settings

PowerAngelXD/SakuraE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

408 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌸SakuraE🌸

Based on LLVM, A Compilable Programming Language

Project Structure (Main)

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

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).

Build Steps

  1. Clone the repository:

    git clone https://github.com/powerangelxd/SakuraE.git
    cd SakuraE
  2. Create build directory:

    mkdir build
    cd build
  3. Configure with CMake:

    cmake -G Ninja ..

    This will detect LLVM and set up the build with C++23 standard and necessary flags using Ninja.

  4. Build the project:

    ninja
  5. 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.

IR Developing

For more detailed development specifications regarding the IR, please click the link below.

IR README

Contributor

Sponsor

  • SendsTeam : Provide LLM Service during developing

About

SakuraE is a simple, compiled language based on LLVM.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published