How to convert python code into a simple c haeder?

Question:

I’m Working on a program that takes in text from the user and then implements functionalities in the backend, kind of like an interpreter, I have the parser working amazingly in python but some of the backend capabilities I feel would do great on c. I have looked into CPython but I don’t seem to understand how to do it if it’s even possible at all. I’m just a beginner, if someone could guide that will be very helpful.

Asked By: stephen telian

||

Answers:

CPython is just an implementation of Python in the C programming language. If you want to incorporate C code, you can write extension modules documented here.

Check out this StackOverflow post as well.

Alternatively, write a C program, compile it, and then call it via the subprocess module documented here.

Answered By: Nold
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.