Skip to content

Implementation of A Compiler for Translating C Programming Language to MIPS Assembly

Notifications You must be signed in to change notification settings

SaraBaradaran/C-Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C-Compiler

I have implemented a C compiler using Flex and Bison as tokenizer and parser. This compiler gets a C language program file as input and provides a MIPS assembly output file. You can also run MIPS output file using QtSpim simulator.

Usage guide

Requirements

  • Flex
  • Bison

Flex and Bison are tools for building programs that handle structured input. They were originally tools for building compilers, but they have proven to be useful in many other areas.

You can get and install Flex & Bison tools using the below commands:

sudo apt-get update
sudo apt-get install flex
sudo apt-get install bison

Related Links

Step 1: Download tokenizer.l & parser.y Files

You can clone codes using the below command:

git clone https://github.com/SaraBaradaran/C-Compiler

Step 2: Compile & Run Files

flex tokenizer.l
bison -d parser.y
gcc parser.tab.c lex.yy.c -o compiler

Step 3: Compile Your C Program Using My Compiler

Finally, you can compile your C program using the below command:

./compiler input.c output.asm

About

Implementation of A Compiler for Translating C Programming Language to MIPS Assembly

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published