AI-powered Python β C++20 code migration with automated compilation, execution, benchmarking, evaluation, and reporting.
π Live Demo Β Β β’Β Β π» GitHub Repository
π https://ai-code-migration-platform-zievvdkcz9mr83emx2brgv.streamlit.app/
The application is deployed on Streamlit Community Cloud and provides an end-to-end Python-to-C++20 migration workflow.
Python Source
β
βΌ
AI Analysis
β
βΌ
Python β C++20
β
βΌ
C++ Compilation
β
βΌ
Executable
β
βΌ
Execution
β
βΌ
Benchmarking
β
βΌ
Evaluation
β
βΌ
Migration Report
β
βΌ
Leaderboard
AI Code Migration Platform is a production-oriented AI application designed to automate the migration of Python programs into standalone, compilable modern C++20 programs.
Unlike a basic code translator, the platform validates the entire migration lifecycle:
Translate β Analyze β Compile β Execute β Benchmark β Evaluate β Report
The system uses an extensible provider architecture so different LLM backends can be integrated without changing the core migration pipeline.
| Capability | Status |
|---|---|
| Python β C++20 translation | β |
| LLM-powered migration | β |
| Groq provider | β |
| Ollama provider | β |
| Provider factory architecture | β |
| Python source analysis | β |
| Automatic C++ compilation | β |
| Executable validation | β |
| Runtime execution | β |
| Multi-run benchmarking | β |
| Migration evaluation | β |
| JSON reporting | β |
| Leaderboard | β |
| CLI interface | β |
| Streamlit interface | β |
| Structured logging | β |
| Centralized exceptions | β |
| Automated test suite | β |
| Cloud deployment | β |
βββββββββββββββββββββββββββ
β User / Client β
ββββββββββββββ¬βββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β CLI / Streamlit β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β Input Validation β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β Provider Factory β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββββββββββββββ΄βββββββββββββββββββ
β β
ββββββββββΌβββββββββ βββββββββββΌβββββββββ
β Groq β β Ollama β
β LLM β β LLM β
ββββββββββ¬βββββββββ βββββββββββ¬βββββββββ
β β
ββββββββββββββββββββ¬βββββββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β Translator β
β Python β C++20 β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β Python Analyzer β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β Compiler β
β g++ / C++20 β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β Executor β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β Benchmark β
β Multiple Runs β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β Evaluator β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β Report Generator β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β Output Manager β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β Leaderboard β
βββββββββββββββββββββββββββββββ
The platform treats code migration as a complete engineering pipeline rather than a single LLM request.
The input Python file is validated before the migration begins.
The selected provider generates standalone modern C++20 source code.
The Python source is analyzed to provide additional structural information to the migration process.
Generated C++ is compiled using the configured C++ compiler and C++20 standard.
The compiled executable is executed with configurable timeout protection.
The generated program is executed multiple times to calculate runtime performance.
Translation, compilation, execution, and benchmark results are aggregated into an overall migration result.
A structured migration report is generated.
Migration results can be recorded for performance comparison.
The project uses a provider abstraction to keep LLM integrations independent from the migration pipeline.
ββββββββββββββββββββββββ
β BaseProvider β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββ΄ββββββββββββ
β β
ββββββββββΌβββββββββ ββββββββββΌβββββββββ
β GroqProvider β β OllamaProvider β
βββββββββββββββββββ βββββββββββββββββββ
The deployed application currently uses:
Provider: Groq
Model: openai/gpt-oss-120b
Ollama support allows local LLM execution during development and experimentation.
The provider factory makes it possible to add future providers without rewriting the migration pipeline.
- Python
- C++20
- g++
- Groq
- Ollama
- Streamlit
- argparse
- Pytest
- Ruff
- Black
- python-dotenv
- Structured logging
- Custom exception hierarchy
- GitHub
- Streamlit Community Cloud
AI-Code-Migration-Platform/
β
βββ analyzer/
β βββ __init__.py
β βββ python_analyzer.py
β
βββ benchmark/
β βββ __init__.py
β βββ benchmark.py
β
βββ cli/
β βββ __init__.py
β βββ arguments.py
β βββ validators.py
β
βββ compiler/
β βββ __init__.py
β βββ compiler.py
β βββ executor.py
β
βββ evaluator/
β βββ __init__.py
β βββ evaluator.py
β
βββ leaderboard/
β βββ __init__.py
β βββ leaderboard_entry.py
β βββ leaderboard_store.py
β βββ manager.py
β
βββ pipeline/
β βββ __init__.py
β βββ migration_pipeline.py
β
βββ providers/
β βββ __init__.py
β βββ base_provider.py
β βββ groq_provider.py
β βββ ollama_provider.py
β βββ provider_factory.py
β
βββ report/
β βββ __init__.py
β βββ report_generator.py
β
βββ translator/
β βββ __init__.py
β βββ prompt_builder.py
β βββ translator.py
β
βββ utils/
β βββ __init__.py
β βββ exceptions.py
β βββ helpers.py
β βββ logger.py
β
βββ workspace/
β βββ __init__.py
β βββ workspace_manager.py
β
βββ tests/
β βββ test_analyzer/
β βββ test_benchmark/
β βββ test_cli/
β βββ test_compiler/
β βββ test_evaluator/
β βββ test_groq/
β βββ test_leaderboard/
β βββ test_pipeline/
β βββ test_report/
β βββ test_translator/
β βββ test_workspace/
β βββ test_main.py
β
βββ app.py
βββ config.py
βββ main.py
βββ requirements.txt
βββ .env.example
βββ .gitignore
βββ LICENSE
βββ README.md
Make sure the following are installed:
- Python 3.x
- Git
- g++
- An LLM provider/API key
git clone https://github.com/creatorKrishna05/ai-code-migration-platform.git
cd ai-code-migration-platformpython -m venv .venv
.venv\Scripts\activatepython -m venv .venv
source .venv/bin/activatepip install -r requirements.txtCreate a .env file from .env.example.
Example:
GROQ_API_KEY=your_groq_api_keyFor Streamlit Cloud, configure secrets through the application's deployment settings.
Never commit API keys or credentials to GitHub.
The platform includes a complete command-line interface.
python main.py migrate examples/sample.pypython main.py migrate examples/sample.py --provider groqpython main.py migrate examples/sample.py \
--provider groq \
--model "openai/gpt-oss-120b"python main.py migrate examples/sample.py --benchmark-runs 5python main.py migrate examples/sample.py --timeout 30python main.py migrate examples/sample.py --report-jsonStart Streamlit locally:
streamlit run app.pyThen open the local Streamlit URL displayed in the terminal.
The benchmark system executes the generated program multiple times and calculates the average runtime.
Example production verification:
Benchmark runs: 5
Average execution: 0.001900 seconds
This provides a simple performance signal for generated C++ programs.
A successful migration can generate:
outputs/
βββ source.cpp
βββ program
βββ report.json
βββ leaderboard.json
On Windows, the compiled executable may use:
program.exe
The exact executable name depends on the operating system.
The leaderboard tracks migration results and provides a foundation for comparing migration performance.
Current local storage:
outputs/leaderboard.json
For production-scale deployments, persistent external storage can be introduced in future iterations.
The project has a comprehensive automated test suite.
Run:
python -m pytest -q170 passed in 3.67s
- CLI argument parsing
- CLI validation
- Provider initialization
- Groq provider
- Ollama provider
- Translation
- Python analysis
- Compilation
- Execution
- Benchmarking
- Evaluation
- Reporting
- Leaderboard
- Workspace management
- Pipeline orchestration
- Application entry point
The application is deployed on Streamlit Community Cloud.
π https://ai-code-migration-platform-zievvdkcz9mr83emx2brgv.streamlit.app/
The deployed environment has successfully completed an end-to-end migration using:
Groq
β
openai/gpt-oss-120b
β
Python β C++20
β
g++
β
Executable
β
5Γ Benchmark
β
Evaluation
β
Report
β
Leaderboard
Application startup β
Dependencies β
Groq provider β
LLM generation β
Translation β
C++ compilation β
Executable execution β
Benchmarking β
Evaluation β
Report generation β
Output generation β
Leaderboard β
End-to-end pipeline β
The platform implements centralized exception handling.
Supported failure categories include:
- CLI validation errors
- Provider errors
- Translation errors
- Compilation errors
- Execution errors
- Benchmarking errors
- Evaluation errors
- Pipeline errors
CLI exit codes:
0 β Success
1 β Application / migration failure
2 β Invalid CLI input
The application uses structured logging across the migration lifecycle.
Example:
Starting migration pipeline.
Starting code translation.
Sending translation request to Groq.
Code translation completed successfully.
Starting C++ compilation.
C++ compilation completed successfully.
Execution completed with return code: 0.
Benchmark completed.
Evaluation completed successfully.
Migration report generated successfully.
Migration pipeline completed successfully.
Generated C++ code is compiled and executed as part of the migration process.
Current safeguards include:
- Configurable execution timeout
- Temporary workspaces
- Input validation
- Structured exception handling
- Environment-based secret management
- Controlled compilation workflow
For unrestricted production workloads, additional isolation such as containerization or sandboxed execution is recommended.
The project is designed around several software engineering principles:
Each major responsibility is implemented as an independent service.
LLM providers implement a common interface.
Core pipeline components are wired explicitly through the application composition layer.
Application failures use a structured exception hierarchy.
Services are independently testable through unit and integration tests.
Important pipeline events are captured through structured logging.
New providers and migration capabilities can be added without redesigning the entire system.
- Stronger execution sandboxing
- Persistent cloud leaderboard
- Improved Streamlit result dashboard
- Migration history
- Better generated-code validation
- More integration tests
- Additional LLM providers
- Containerized compilation
- Advanced performance analytics
- Parallel benchmarking
- Semantic equivalence checking
- Multi-language migration support
- Enterprise deployment architecture
Traditional code migration can require significant manual effort.
This platform explores how LLMs can be integrated into a complete software engineering workflow, where generated code is not simply returned to the user but is:
Generated
β
Analyzed
β
Compiled
β
Executed
β
Benchmarked
β
Evaluated
β
Reported
This makes the project more than an AI code-generation demoβit is an end-to-end AI-assisted migration pipeline.
| Area | Status |
|---|---|
| Core architecture | π’ Complete |
| Python β C++20 migration | π’ Complete |
| Groq integration | π’ Complete |
| Ollama integration | π’ Complete |
| Compiler pipeline | π’ Complete |
| Execution pipeline | π’ Complete |
| Benchmarking | π’ Complete |
| Evaluation | π’ Complete |
| Reporting | π’ Complete |
| Leaderboard | π’ Complete |
| CLI | π’ Complete |
| Streamlit UI | π’ Complete |
| Cloud deployment | π’ Complete |
| Automated tests | π’ 170 passed |
| Advanced sandboxing | π‘ Planned |
| Persistent cloud storage | π‘ Planned |
BCA Student & AI/ML Developer
GitHub: https://github.com/creatorKrishna05
This project is licensed under the MIT License.
See LICENSE for details.
If you find this project interesting or useful:
β Star the repository
π΄ Fork the project
π Open an issue
π‘ Suggest an improvement
Translate. Compile. Execute. Benchmark. Evaluate.
π Launch Live Demo β