[Tutor] Meta language and code generation

Knacktus knacktus at googlemail.com
Fri Apr 1 20:29:09 CEST 2011


Am 01.04.2011 19:09, schrieb Karim:
>
> Hello All,
>
> I would to ask you if somebody has experience or can give direction in a
> new project I have.
> I have a meta language description (in xml) from which I should generate
> code on different
> languages. In my case, lisp and tcl.

You need to provide more information of your description to get some 
specific hints. The other day a had a xml file containing a business 
object model with hierarchy and relations. Then I wrote a code generator 
to build a module with Python classes for each business item. The code 
generator created properties for lazily resolving relations modelled via 
ids in the database and stuff like that. This was very straightforeward 
using a simple print statements like the following:

print "class %s(object):\n" % class_name
print "    def __init__(self, %s)" % constr_arg
...

Cheers,

Jan

>
> Any idea in term of design, examples, links will be appreciated!
>
> Kind Regards
> Karim
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list