February 13, 2004

Cog - use Python for inline code generation

Cog from Ned Batchelder is a tool for generating code.

To use cog you insert blocks of simple python into your source code (delimited by special comments) and then run cog over the file. Cog inserts the generated code into the source file (replacing any previous cog-generated code).

I'm using Cog to create large message-type enumerations and message factories in three different code libraries - one in Java, one C++ and one C#.

http://www.nedbatchelder.com/code/cog/index.html

Recommended.

Posted by Simon at February 13, 2004 11:44 AM
Feedback