Automated code generation

darrell dgallion at yahoo.com
Sun Sep 7 21:35:51 CEST 2003


I write tools for testing embedded systems.
They parse the .h files and doc files to associate names with hex 
values... This produces meg's of .py files which then support writing 
tools and test scripts.

Everything from structure layout to:

EMERGENCY_STOP_CMD=0x1234567L
...
SOME_STRUCT=(["f1","f2","f3"],">fI10s")
...
ERROR_100="Somethig bad"


Does this qualify as code generation?

When the project wants to change something like how we "log".
Python is used to parse the entire source tree making changes.
Not Python code generation but it's more complicated than 
search/replace. And could be applied to a Python code base as well

Is this code generation?

--Darrell


Max M wrote:
> Yesterday there was an article on Slashdot:
> http://books.slashdot.org/article.pl?sid=03/09/04/1415210&mode=flat&tid=108&tid=126&tid=156 
> 
> 
> It is about automatic code generation.
> 
> I got interrested in the subject, did a web search, and it seems kind of 
> powerfull.
> 
> My main interrest is web development in Zope/CMF/Plone, where there is a 
> lot of repeated code in the products. So automated code generation seems 
> like a natural fit.
> 
> But every time I think of a use case, I immediately think of a way to do 
> it with encapsulation instead.
> 
> Does anybody have any experience using Python and automated code 
> generation where it actually make sense?
> 
> Or os it useless in a language as dynamic as Python?
> 
> 
> regards max M
> 





More information about the Python-list mailing list