Skip to content
A Mini C Compiler
C++ Batchfile Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.



This is a modular mini C compiler.

It can translate a subset of C language into MIPS assembly language.

Currently it's unfinished ,there are still a lot of work to do. Help is welcomed.

Basic Module Functions are as follows.

PreProcessor: delete comments.

Scanner: Tokenize the input stream.

Parser: Generate Parse tree.

SemanticAnalyser: Reduce the size and length of parse tree, make it into AST.

IR_Generator: Translate the AST into IR (Intermediate Representation). In this case, we use linear three address IR.

Optimizer: Not yet implemented. Will function as IR optimizer in order to reduce Time/Space Complexity in the future.

Code_Generator: Generate RISC assembly code from IR.

XML_suit: Parse the XML input and Generate the XML output. Note that XML format can be found at XML_examples directory.

[Warning] There are still a lot of work to be done, currently the XML input and output of each module is handled by the their own version of XML suit, this will be fixed in the future.


Suppose you have a file named test.c

Put the module binary in the root directory, and then (eg. Scanner.exe)


run.bat test

Unix(Including macOS & Linux)

$./ test

If it prompts that the permission is denied.

Please execute this command first:

$chmod 755


Inspired by bit-minic-compiler


  • No code from bit-mini-compiler is taken to this project
  • This project is for educational purpose only, I'm not responsible for the consequences of error assembly code it generated.
You can’t perform that action at this time.