Skip to content

C to Python Translator and a C to MIPS Assembly Compiler implemented in C++

License

Notifications You must be signed in to change notification settings

ghchen99/langproc-compiler

Repository files navigation

C to Python Translator and C to MIPS Assembly Compiler

This repository contains two language processors implemented in C++. These processors are part of the Language Processors module taught at Imperial College London. The processors are:

  1. C to Python Translator
  2. C to MIPS Assembly Compiler

C to Python Translator

The C to Python Translator is a program that translates C code into equivalent Python code. It helps developers to migrate existing C codebases to Python or understand the functionality of C code by providing a Python equivalent.

Usage

To use the C to Python Translator, follow these steps:

  1. Clone the repository: git clone <repository_url>
  2. Navigate to the C to Python Translator directory
  3. Compile the source code: g++ -o translator translator.cpp
  4. Run the translator with the input C file: ./translator input.c
  5. Make sure to replace input.c with the path to your desired C file.

Features

The C to Python Translator supports the following features:

  • Basic variable declarations and assignments
  • Arithmetic and logical expressions
  • Control flow statements (if, else, while, for)
  • Functions and function calls

C to MIPS Assembly Compiler

The C to MIPS Assembly Compiler is a program that compiles C code into MIPS assembly language. MIPS assembly is a low-level language used for programming MIPS processors.

Usage

To use the C to MIPS Assembly Compiler, follow these steps:

  1. Clone the repository: git clone <repository_url>
  2. Navigate to the C to MIPS Compiler directory
  3. Compile the source code: g++ -o compiler compiler.cpp
  4. Run the compiler with the input C file: ./compiler input.c
  5. Make sure to replace input.c with the path to your desired C file.

Features

The C to MIPS Assembly Compiler supports the following features:

  • Basic variable declarations and assignments
  • Arithmetic and logical expressions
  • Control flow statements (if, else, while, for)
  • Functions and function calls

C11 reference standard for guidance: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf

About

C to Python Translator and a C to MIPS Assembly Compiler implemented in C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors