aalhour / aalhour/PyCOOLC

A shopping list of improvements

Open
#15 0 comments 0 reactions 1 assignee Claimed by @aalhour View on GitHub
Dominant language
Python
Stars
41
Forks
10
PR merge metrics
No merged PRs in 30d

Description

Been working for the last few days on polishing and dusting off this project. It now uses Python 3.12+ idioms throughout (match/case, type hints, dataclasses where they make sense), has a proper Makefile + GitHub Actions CI, and most importantly: the code generator actually works now (it was buggy as f*ck). It produces valid MIPS that runs on SPIM without crashing. Which is great.

The compiler frontend was already in decent shape. The lexer, parser, semantic analyzer all had tests and worked fine. But the backend was basically a skeleton that could emit assembly for hello world and not much else. So I spent most of the time debugging codegen issues like stack corruption, string ops returning garbage, and `type_name()` being a stub that returned empty strings :S

The IR + optimization infrastructure (TAC, CFG, SSA, constant propagation, liveness analysis, dead code elimination) is all there and tested, but it’s not actually wired into the compilation pipeline yet. Right now it’s more of a teaching tool to show how these things work, not something that affects the emitted code.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue describes integrating the existing IR and optimization infrastructure (TAC, CFG, SSA, constant propagation, liveness analysis, dead code elimination) into the compilation pipeline. Start by examining the code generator and the IR modules to understand their current separation. Look for the main compilation flow and identify where IR transformations should be inserted before final MIPS code generation. 'Done' means the optimizations affect the emitted assembly, verified by running existing tests or new benchmarks.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.