How to write a program that itself write and execute program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to write a program that itself write and execute program?

22nd Jun 2021, 3:41 PM
Zahed Shaikh
Zahed Shaikh - avatar
2 Answers
+ 3
What you describe is generally referred to as 'metaprogramming'. And usually, for everyday tasks, it's not worth bothering with, because it adds a whole new level of abstraction that can make your program much more difficult to understand and debug. However if you are willing to put in the effort, you can gain a deeper understanding about the inner mechanics of the language. Related to Python this is your source to study: https://realpython.com/python-metaclasses/
22nd Jun 2021, 5:46 PM
Tibor Santa
Tibor Santa - avatar
+ 1
Here is an example of how a C++ program can write and execute a FORTRAN program on SoloLearn. https://code.sololearn.com/cSFgwWBqPAWy/?ref=app
22nd Jun 2021, 6:14 PM
Brian
Brian - avatar