Reputation: 103
I have used JET with Eclipse before to generate Java files from models. I am new to Python and I am searching for a way to generate python modules automatically based on parameters (data) read from the user -for educational purposes.
For example, a student will be guided to a webpage, where he/she enters the name of a project, select different control statements (ie.a while loop), enter a boolean expression, and the loop body, and hit generate. The webpage will generate a .py module for him/her that could be used for educational purposes.
After research, I found many python generators out there, and I guess Jinja is one of the most popular ones. But I would like to know if I am going the right direction before making a decision.
So my questions are as:
Upvotes: 3
Views: 1581
Reputation: 2460
If you just want to generate Python code from a model you can try Telosys code generator : http://www.telosys.org/.
It allows to generate code for different kinds of languages including Python.
In your case I suggest to create a basic DSL model (or download the DSL model example from here http://www.telosys.org/download/models-v3/ ) and use the following templates for Python :
The "CLI" version of Telosys is probably the best option (because it's independent from any IDE) : https://github.com/telosys-tools-bricks/telosys-cli/wiki
Upvotes: 3