Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

XML translation for block structured languages

IP.com Disclosure Number: IPCOM000013850D
Original Publication Date: 2001-Apr-16
Included in the Prior Art Database: 2003-Jun-18
Document File: 2 page(s) / 28K

Publishing Venue

IBM

Abstract

This invention has consequences for code reuse, program portability, porting and translation. Disclosed is an invention for rendering a block structured program (e.g. one written in C/C++/Java*/Cobol, etc. as XML. The advantages of this are that this gives a language independent description of a program that can be used (in part) to port programs more easily, automatically recognise candidate code for reuse, and allow someone to use an XML parser on source code to extract various properties from browsers. etc. The following code is provided by way of example: int main (void) int i=0; for (i=0; i< 10; i++) if (i 7) printf("%d does not equal 7", i); This code, although simplistic, demonstrates the block structured nature of C/C++/Java code. This code can for example be rendered as XML as follows (the code maintains its structure, but uses tags rather than blocks):

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 77% of the total text.

Page 1 of 2

XML translation for block structured languages

This invention has consequences for code reuse, program
portability, porting and translation.

     Disclosed is an invention for rendering a block structured
program (e.g. one written in C/C++/Java*/Cobol, etc. as XML.
The advantages of this are that this gives a language independent
description of a program that can be used (in part) to port
programs more easily, automatically recognise candidate code for
reuse, and allow someone to use an XML parser on source code to
extract various properties from browsers. etc.

The following code is provided by way of example:
int main (void) {
int i=0;
for (i=0; i< 10; i++) {
if (i != 7) {
printf("%d does not equal 7", i);
}

}

}

     This code, although simplistic, demonstrates the block
structured nature of C/C++/Java code. This code can for example
be rendered as XML as follows (the code maintains its structure,
but uses tags rather than blocks):

<main return="int" args="void">

<define label="i" type="int" value=0 />
<for initial="i=0" cond="i<10" increment="i++">

<if cond="i != 7">

                  <printf string="%d does not equal 7"
arglist="i" />

          </if>
</for>
</main>

     This new structure can be used to represent the logic of the
code, and its basic flow. The purpose of this is to allow one to
use existing XML parsers to query code, possibly browse the code,
and translate code between languages. There are many other
issues involved when porting code, e.g. name mangling, pointers,
etc. but this makes the block structure portabl...