Ask coding questions

← Back to all posts
Python3 To C++ Compiler (Prototype)
TurtleAndrew (199)

I spent a few hours working on a basic compiler that converts python3 code (one of the easier languages to learn) to c++ (one of the harder languages to learn). This would let you write code in python3 but still have the speed of c++. This prototype is far from good and needs hours of work. I was wondering if i could get help (as in a group of people to help me develop it) making it sence python3 is very different from c++ and will need tons of work to get properly and consistently converting. I want this to be very easy to use so all you have to do is run the program with the file's title and have it convert it to runable c++ code with no editing of the converted file required. I also want to have the converted c++ code maintain formating so anyone wanting to switch for python3 to c++ (on a project) can easily convert the code and use the converted code. There's also many features i want that i have know idea on how to add such as converting the code under imports that are used to c++. You will need to know python3 sorta well and some c++. If anyone wants to help me develop this then comment bellow and I'll set up a multiplayer replit for it. I'm looking for 3-6 people to help out and more would always be appreciated.

When you run the program, it prints the output (the c++ code which is runable). The code that is being converted can be found under the "python3_to_c.Cpy" file. The converter its self can be found under the "python3_to_c.py" file. The outputed c++ file can be found under the "python3_to_c.cpp" file. You can change the code under the "python3_to_c.Cpy" file and when run the output will be different. Note that it is very basic and dosent support many python3 syntaxes.

Comments
hotnewtop
BananaJellyfish (205)

I know a lot of python, but no c++. Im planning on learning it but i may take a while since i have very little time. Im also unsure as to whether python3 is the python i know.

BananaJellyfish (205)

@BananaJellyfish actually, it is python3 i know. Also, im sure c++ isn't too different from python and js

TurtleAndrew (199)

@BananaJellyfish It is and isn't similar (c++). The basic structure is essentially the same but once you get into classes (like objects), it becomes quite different.

BananaJellyfish (205)

Yeah, i might have a problem with things like that. Edit: i just looked at the code and it seems pretty similar to js, which i'm learning right now @TurtleAndrew

BananaJellyfish (205)

Wait, which language will you make this in? @TurtleAndrew

TurtleAndrew (199)

@BananaJellyfish Im making the compiler in python3 and the output is c++

TurtleAndrew (199)

@TurtleAndrew Also, i was talking on discord with my friends, we then started to spam eachother (for fun), now i have made a spam bot (that i made in python3) so i can spam them without putting in any effort.

BananaJellyfish (205)

@TurtleAndrew so how is it going to work? It'll take all your python3 code and turn it into c++? So all your if statekents and things will be changed? Surely that would be a lot of work, considering the amount of functions in python3

notGilbert (71)

that sounds like a challenge (many, many differences and abstraction between the languages)

TurtleAndrew (199)

@notGilbert definitely. It's possible though.