[Tutor] Meta language and code generation

Karim karim.liateni at free.fr
Fri Apr 1 20:56:16 CEST 2011


On 04/01/2011 08:29 PM, Knacktus wrote:
> 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


In fact in xml I have something like that:

A metafunction in fact kind of

<metfunc name=call_back_do_stuff_function>
<parameter>x</parameter>
<parameter>y</parameter>
</metafunc>


I have to generate the call_back_do_stuff_function(x,y) in lisp and tcl 
according to a catalog of specs
of what this function must do generically.

I can do prints for each metafunctio I read but my concern is is there 
std libs to help to have good design
and methodology. Is it interesting to use command module of something 
like that, is interesting to use
a parser like pylex or pyparsing? I have 50 metafunctions in catalog for 
now.

In fact, my point is to have a great extensive design methodology.
Strategy pattern would suit?
Other patterns? std modules?

Lots of question here!

Regards
Karim


>
>>
>> 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
>
> _______________________________________________
> 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