3

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:

  1. What is the best python code generator that fits my project idea the most?
  2. Should I build the web interface of such a project using a Python platform, or something else like PHP?

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.