Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exploring the QBE Compiler Backend

This project is an experimental playground for understanding and exploring the internals of the QBE compiler backend.

The main goal is to study how code is lowered and processed by QBE by compiling a main.py file through a QBE-based backend pipeline, while leveraging the stb_lexer library for lexical analysis.


Project Goals

  • Explore the design and structure of the QBE backend
  • Understand intermediate representations (IR)
  • Experiment with code generation workflows
  • Study how source code can be transformed before reaching QBE
  • Gain hands-on experience with low-level compilation concepts

Overview

This project works by:

  1. Reading and processing main.py
  2. Tokenizing or lexing input using stb_lexer
  3. Transforming the parsed data into an intermediate representation
  4. Passing the generated IR to QBE
  5. Producing compiled output via QBE

The focus is not on building a production-ready compiler, but rather on experimentation, learning, and backend exploration.


Dependencies

  • QBE
  • stb_lexer
  • A C compiler (gcc or clang)
  • Python (for main.py input file)
  • nob.h
  • arena.h

Install QBE

Clone and build QBE:

git clone https://c9x.me/git/qbe.git
cd qbe
make

Ensure qbe is available in your PATH.


Quick Start

Compile your project using your preferred build system:

make run

The program will:

  • Compiles compiler
  • Runs the compiler to reads main.py file to emit QBE IR files
  • Compiles QBE IR file using QBE

⚠️ Disclaimer

This project is experimental and intended for educational purposes. It is not a full Python compiler and does not aim to implement the entire Python language specification.


📚 References


About

Experimental playground for understanding and exploring the internals of the QBE compiler backend.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages