Xml Code Generator

(Last updated: 2005-04-19)

Project Members

Goals

To develop a tool that will allow the development of object-oriented applications by using a code generation based approach. The system, although implemented for/in Microsoft .Net, should be designed so it can be applied to other object oriented languages (such as Java) as well. The system will be designed so it can be extended to allow the creation of virtually any type of class.

Abstract

XCG is a code generation system that allows the user, by using Xml syntax, to specify his classes, and the objects contained in it, and the initial values. Using special constructs (that can be extended by the user to fit his/her needs) any kind of members can be generated with as little or as much control as the user wants. This minimizes the writing of repetitive code, and allows for a more structured source where initialization and declaration of members is done in the same location (as opposed to initialization in the constructor and declaration elsewhere).

Introduction

An introduction to XCG.
(Updated 2005-02-24)

Design

The application will use xml syntax, which is outlined in the introduction. This is what the user of XCG has to deal with, and uses to create his/her classes. The xml is parsed and used to generate a CodeDom tree, which will then be used to generate the source code.

Design of the XCG code generation engine. (Updated 2005-02-24)

Using hand-crafted code to extend generated code [pdf]

Implementation

The implementation uses Microsoft .Net, although as mentioned above the techniques are equally applicable to something like Java. The engine will be implemented in C#. Because we use CodeDom, any language that has a CodeDomProvider, including Visual Basic .Net, C#, Managed Extensions for C++, Visual J# and JScript.Net, can be used as output.

The implementation functions on Microsoft .Net as well as Mono, which will allow cross-platform functioning.

Software Requirements

For Microsoft .Net:

(Note: it is recommended to get both the .Net Framework and SP1 from Windows Update)

For Mono:

Hardware Requirements

No special hardware requirements.

Deliverables

XCG final source code [zip]
Read the readme.txt file for instructions on building. You can build XCG under Windows using Visual Studio .Net, or under various platforms (including Windows and Linux, and also supporting Mono) using NAnt.

Binaries: [zip]
The binaries include xcgcl (the command-line compiler) and the XCG Custom Tool for Visual Studio .Net 2003. The complete documentation is also included, as well as several examples.

Documentation: [html]

References