Skip to content

pratikab/Compiler-C-to-X86

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS335: Compiler Design

Creating a C compiler for x86 machines in python

Requirements

  • Install python-2.7 and pip2 in your machine
  • Install ply : pip install ply
  • Install pydot : pip install pydot

Usage

For generating parse tree on test example

  • cd <project-top>/src
  • python2 cparser.py ../test/<filename> <graph_name.png> Graph will be generated in the test directory

For generating .S files for given .C file

  • cd <project-top>/test
  • python2 ../src/code_generation.py <filename>

Output files named a.S will be generated. Which can be further used by assembler to generate .out binary file.

  • ./run.sh

Credits

Contributors

  • Bhangale Pratik Anil (14173)
  • Shibhansh Dohare (14644)

About

Simple python compiler for .c code to .s (x86 assembly code)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published