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:
- C to Python Translator
- C to MIPS Assembly Compiler
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.
To use the C to Python Translator, follow these steps:
- Clone the repository: git clone <repository_url>
- Navigate to the C to Python Translator directory
- Compile the source code: g++ -o translator translator.cpp
- Run the translator with the input C file: ./translator input.c
- Make sure to replace input.c with the path to your desired C file.
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
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.
To use the C to MIPS Assembly Compiler, follow these steps:
- Clone the repository: git clone <repository_url>
- Navigate to the C to MIPS Compiler directory
- Compile the source code: g++ -o compiler compiler.cpp
- Run the compiler with the input C file: ./compiler input.c
- Make sure to replace input.c with the path to your desired C file.
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