C-to-MIPS Compiler

  • Project Time: Mar. 2022
  • Project URL: GitHub

Project Description


The project is a C to MIPS compiler written in C++. The compiler performs lexical analysis, parsing, and generates corresponding MIPS code from the provided input C program. The compiler supports various types of calculations, including integers, floating-point numbers, and doubles. It also handles pointers and arrays, as well as character data type. Additionally, the compiler implements essential C language features such as loops, if/else statements, enumerations, typedef, and struct. The implementation of the compiler is based on register allocation and stack management techniques to optimise the generated MIPS code for efficient execution.

This project is a part of the Instruction Architecture and Compiler course in 2nd Year Imperial College London EIE department. The project passed all provided testcases and 184 out of 202 of examiners' testcases (including unseen tests not in this repo).