Py2C

A minimal Python-to-C compiler designed to demonstrate compiler front-end design, intermediate representations, optimization passes, and code generation.

About the Project

Py2C is an educational compiler that translates a restricted subset of Python into readable, standards-compliant C code. The project emphasizes clarity of design, modularity, and correctness over language completeness.

Py2C follows a classic compiler architecture: parsing → IR construction → optimization → code generation.

README

Project overview, features, architecture, and usage.

Read README →
Getting Started

Design Decisions

Key architectural and technical decisions behind Py2C.

Open design-decisions →
Research-Oriented

Documentation

Overview

High-level design goals and architectural decisions.

Open overview.md →

Parser

AST parsing strategy and Python front-end design.

Open parser.md →

Intermediate Representation

IR node design, structure, and semantics.

Open ir.md →

Optimizations

Constant folding and dead code elimination.

Open optimizations.md →

Code Generation

Lowering IR into readable C code.

Open codegen.md →

Limitations & Future Work

Design trade-offs and extension roadmap.

Open future work →
Research-Oriented

Academic Focus

Py2C is designed as a systems and compiler engineering project, suitable for graduate-level coursework, research exploration, and MS/MEng program evaluation.

The project demonstrates understanding of: parsing, IR design, optimization passes, control flow, and backend code generation.