It seems to me that it would be useful to have a standardised way to encode source code in XML form. This could be used for the following:
- When encoded an XSLT script XES could then be used to translate the code
into other forms, such as:
- Conversion to other languages, XSLT might not easily do a complete conversion without error, but it could at least do the first step and take some of the drudgery out of human conversion.
- Generation of documentation such as UML diagrams and other diagrams possibly in SVG format.
- XES could be a good intermediate format for code generators.
- XES can hold code in a format where the first parsing stage of compiling
has already been done, this would allow:
- code to be more quickly compiled on the fly.
- Open Source code to be distributed in this form with Linux so that it can be compiled more quickly and with less errors than distributing it
- To allow some small level of language independence in code distributing code without loosing any information.
- XES could define an intermediate language, like Java or C# intermediate code, which is more like the source code but could still be interpreted at runtime.
- XES could provide a much better way to mix scripting code in with XML data.
- XES could provide a more general way to define algorithms together with the data it is acting on.
An explanation of the requrements for the schema is shown here.
- To download this code go here.
- To see what this program can do see user guide.
Design Objectives
- XES stores source code in XML format.
- This should contain full source code including comments.
- It should be optimised for machine reading (since users are unlikely to type XML by hand).
- The number of elements and the complexity should be minimised.
- The design should be optimised to allow the fastest possible translation, compiling or interpretation of code.
- It should code the syntax of the language, but not necessarily things like: does the laguage have garbage collection, does the language support multiple inheritance. XES should support any combination of these things, perhaps there could be a global attribute to say whether these are true or not.
For example, where a method is called it should be linked back as easily as possible to the definition of the method and its class definition, even if there is late binding due to virtual classes.