- A model that describe your application - you don't need to define it yourself, you can use XMI or XML schema as the reference model. The only problem is how you parse them to the object model.
- A template engine - Velocity or Freemaker are good template engines in Java.
- Templates that corresponding to the model - Generate code Java, PHP, C#, etc.
- A configuration of templates - There would be configurations for desktop app, web app, RIA, or web services, etc.
- A parser that parse the configuration - If the configuration is an XML file, Apache's commons-digester library can help.
- A driver to glue up everthing.
- Optionally, a validator for the template is good - JavaCC or ANTRL for syntax validation. For the extreme, use a compiler to verify the correctness of the generated code.
Sunday, January 29, 2006
How to build a source code generator
Labels:
code generator,
java
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment