Skip to main content

convert c/cpp code to python.

Project description

cpp2py

A tool to convert c/c++ code to python code

how to install:

pip install cpp2py

how to use in python:

import cpp2py cpp2py.c2py(input_c_file_path, output_py_file_name) cpp2py.py2c(input_py_file_path, output_c_file_name)

from cpp2py import cpp2py
cpp2py.c2py('./c1.c', 'c1.py')

c1.c:

int main(int argc, char **argv)
{
int a=1;
int b=2;
int c;
c=a+b;
return 0;
}

generated: c1.py

def main(argc, argv):
	a = 1
	b = 2
	c = a+b
	return 0


how to use in cmd(TBD):

python -m cpp2py -i input_c_file_path -o output_py_file_path -f convert_format eg: python -m cpp2py -i input_file.c -o output.py -f c2py

convert_format: c2py py2c cpp2py py2cpp

current stage

c2py C
py2c X
cpp2py X
py2cpp X

x--not finished
y--finished
C--partly working

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

cpp2py-0.0.2-py3-none-any.whl (19.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page