0% found this document useful (0 votes)
5 views6 pages

PBL Compiler

The project titled 'Compile - C Program Converter to Programming Language (Python)' aims to automate the translation of legacy C code into Python, addressing the need for developers and educators. The team, Code Storm, consists of four members led by Praveen Rana, and plans to create a modular tool that parses C code and generates equivalent Python code while preserving functionality. The project includes multiple phases such as requirement gathering, syntax parsing, and testing, with deliverables including a working code converter tool and comprehensive documentation.

Uploaded by

Abhishek Negi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

PBL Compiler

The project titled 'Compile - C Program Converter to Programming Language (Python)' aims to automate the translation of legacy C code into Python, addressing the need for developers and educators. The team, Code Storm, consists of four members led by Praveen Rana, and plans to create a modular tool that parses C code and generates equivalent Python code while preserving functionality. The project includes multiple phases such as requirement gathering, syntax parsing, and testing, with deliverables including a working code converter tool and comprehensive documentation.

Uploaded by

Abhishek Negi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

PROJECT AND TEAM INFORMATION

Project Title

Compile - C Program Converter to Programming Language


( Python)

Student / Team Information

Team Name: Code Storm


Team # Code Storm

 Team Leader:

PRAVEEN RANA
Student ID: 220111609
Email: [email protected]

 Team Member 2:

ADITYA DIMRI
Student ID: 220112100
Email: [email protected]
 Team Member 3:

ABHAY BARTWAL
Student ID: 220111351

Email: [email protected]

 Team Member 4:

ASHISH NEGI
Student ID: 220111131
Email: [email protected]
PROPOSAL DESCRIPTION
Motivation

Programming languages evolve rapidly, and developers often find


themselves needing to translate legacy C code into modern, high-level
languages like Python. Manually rewriting large codebases is time-
consuming and error-prone. This project aims to automate that process by
creating a tool that can parse C source code and convert it into equivalent
code in other languages, starting with Python.

This tool can be especially useful for:

 Educators helping students transition from low-level to high-level


programming.

 Developers maintaining legacy systems.

 Researchers building compiler or transpiler technologies.

State of the Art / Current Solutions

There are some tools for source-to-source translation, such as:

 C2Rust: Converts C to Rust.

 Emscripten: Compiles C/C++ to WebAssembly.

 PyCParser: Parses C to AST in Python.

However, there are limited solutions that convert C code to Python in a


generalized, automated, and extensible way. This project aims to fill that
gap.

Project Goals and Milestones

Goals:

1. Enable Cross-language Code Migration


Convert standard C syntax to semantically equivalent Python code.

2. Build Modular and Extendable Parser


Use tools like Lex/Yacc or ANTLR to create reusable parsing logic.

3. Support Core Constructs of C Language


Focus on functions, conditionals, loops, arrays, and file I/O in C.

4. Translate Code with Logical Equivalence


Preserve functionality and structure, even if syntactic transformation
is not 1:1.
Milestones:

 Phase 1: Requirement Gathering & Tool Analysis


Research existing C parsers and transpilers.

 Phase 2: C Syntax Parsing


Use Lex/Yacc, PyCParser, or ANTLR to parse and build ASTs from C
code.

 Phase 3: AST to Intermediate Representation (IR)


Create a generic, language-neutral IR for transforming the parsed
code.

 Phase 4: IR to Python Code Generation


Translate IR into equivalent Python syntax.

 Phase 5: Testing and Validation


Test the tool on C code samples and compare outputs.

 Phase 6: Documentation and Reporting


Prepare a full project report with analysis and tool demo.

Project Approach

1. Theoretical Approach
Study grammar rules for C and Python. Understand compiler design
principles and parsing techniques.

2. Simulation-Based Approach
Create a prototype that simulates code translation from C to Python
using predefined templates.

3. Implementation Approach
Build the tool with Python, incorporating C parsing, AST generation,
and code translation.

4. Comparative Study
Compare outputs of the tool with manual translations. Evaluate code
accuracy and efficiency.

5. Performance Analysis
Benchmark translation time, accuracy, and complexity for different
types of input programs.
System Architecture (High-Level Diagram)

+---------------------------+

| User Interface |

| (CLI or Basic GUI Tool) |

+------------+--------------+

+------------v--------------+

| C Code Parser |

| (Lex/Yacc or PyCParser) |

+------------+--------------+

+------------v--------------+

| Abstract Syntax Tree (AST)|

+------------+--------------+

+------------v--------------+

|Intermediate Representation|

+------------+--------------+

+------------v--------------+

| Python Code Generator |

+------------+--------------+

+------------v--------------+

| Output Python Script |

+---------------------------+
Project Outcome / Deliverables

1. Working Code Converter Tool


Command-line tool that converts basic C programs to Python.

2. Final Project Report and Codebase Documentation


Includes explanation of parsing rules, AST structure, and translation
logic.

3. Testing and Comparison Report


Includes test cases, accuracy rates, and sample outputs.

Assumptions

 Input C code will be limited to a defined subset (no macros, complex


pointer arithmetic).

 Python translation will focus on functionality over exact structure.

 Users will manually validate the translated output if the input C code
uses non-standard features.

You might also like