473,473 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

need XML schema to store infomation in a language neutral format

Hi,
I am building a language translator, that must convert input from
source languages to a language neutral format in XML. This XML must be
read by the target language translator and produce the output in the
target language. I am thinking of using a hashed map to handle
translations but am have trouble in deciding on the schema in which the
XML must be stored
The application must work as follows...
{c translator} <---| X M L | <---{vb translator}
int i; stored in Dim i as Integer
printf("%d",i); neutral format Print i

Proposed XML format:
<translate>
<action index=1>i</action>
<action index=2>i</action>
</translate>

the index attribute of the XML tag action will refer to a hash table
that will aid in translations thus
__________________________________________________ ________________
| index | c | vb |
|================================================= =================|
| 1 | int $token | Dim $token as Integer |
| 2 | printf("%d",$token) | print $token |
================================================== =================
Is the XML format and translation method I propose sufficient. Please
consider that the conversion is 100% possible (meaning my translator
excludes C's asm, pointers etc.)

Aug 16 '06 #1
4 1501
There is no language neutral format. Or - in other words:
A "language neutral format" is just another language.
"Language Neutral" was meant to be in the sense that I did not want the
source language to be recognized by looking at the XML, in other words
if 'printf' in c is translated to 'X' in the XML then an equivalent
'cout' in c++ must also be translated to the same 'X'
Mentioning a low-level implementation detail as a hashing when
talking about a very high-level task seems inappropriate.
Sorry about the hash map, I just thought it would make more sense to
explain the index attribute of the xml <actiontag along with the hash
map

Even XML is a low-level implementation detail when in fact you
should be talking about annotated trees or similar structures.
Can you explicate more about "annotated trees or similar structures". I
am not able to find much info on the net. Even if you can suggest some
sites, that'll go a long way
It will be possible for you to translate a small restricted
and controlled subset of both languages...
It is enough if it is translates only a subset, in other words...
though I need to find a way to store in the XML, the functions held by
a c++ class, when translating from xml to c the functions will be
removed and the class be converted to a typedef struct.

Aug 16 '06 #2
It sounds like you're talking about an XML representation of an
Intermediate Language general enough to cover multiple source languages.
Your first step, therefore, is to find or design that IL; from there,
writing an XML rendering of it is straightforward.

I'd recommend reading any of the standard reference works on compiler
design as a starting point for picking your IL. Note that its required
characteristics are going to depend heavily on exactly what operations
you're going to want to perform against that representation.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Aug 16 '06 #3
Thanks Stefan and Joseph.
The IL in XML was intended to be my Proof of Concept for a much bigger
initiative
I shall try to keep this thread updated with the latest.
Thanks again.

Aug 17 '06 #4

Stefan Ram wrote:
"AViS" <mc******@gmail.comwrites:
"Language Neutral" was meant to be in the sense that I did not
want the source language to be recognized by looking at the XML,

This is easy: If any code, such as

printf( "%d", i );

is given, and I tell you that it was translated from a language
X, there is no way for you, to find out what X is. So /every/
representation will fulfil this requirement.
in other words if 'printf' in c is translated to 'X' in the
XML then an equivalent 'cout' in c++ must also be translated
to the same 'X'
The idea of using an intermediate language might not be the best way to
go about it but so what? Let the guy explore, he might find
interresting things and he surely will learn alot.
In general, equivalence between two programs is undecidable.
This whole thing seems fishy to me. If 2 languages are Turing complete,
then they can both represent everything that is representable by a
Turing machine which is everything that is computable. This means that
any program representation in the first language DOES have an
equivalent representation in the second language.

Knowing weather 2 given programs written in 2 different languages are
indeed functionally equivalent if both languages are Turing complete is
far from being a trivial problem but it is possible.
>
See »Equivalence Problem« in

http://www.cs.rochester.edu/u/nelson...decidable.html
Baloney. If the input and output subsets of each program are known for
both programs then they can be compared to evaluate if they are
functionally equivalent. The Equivalence problems speaks of Equivalence
in general terms (whatever that means (nothing in context if you ask
me)). The difficulty resides in our inability to track very complex
problems. They are not impossible to solve, they are simply too complex
to aprehend when taken as a whole upfront.

Of course the proof makes sure not to mention any specific languages.
The proof applies to a program that would compute equivalence for ANY 2
programs. No such program can exist in the first place. The guy isn't
trying to translate anything to everything else, he's writing a
translater that goes from one language to another. Quite challenging,
but not impossible.

[snip]

Regards
Jean-Francois Michaud

Aug 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John | last post by:
I realize this may be too Oracle specific for this forum-- but I've seen a fair amount of postings related to ORacle 9i's XML capabilites so I thought I'd give it a shot. So, I've read in...
2
by: inquirydog | last post by:
I am trying to store my computer network information in an xml file, and plan to write an xml schema for the file. The general format of the xml should be like this <networkinfo>...
6
by: LesleyW | last post by:
Hi Apologies if this is a really dumb question, but being new to XML and Schemas, I wonder if giving the namespace for eg xsd or xsi as a website address means that the user has to be online...
3
by: Sathyaish | last post by:
Thingies: - Report Definition Language (RDL) - Resource Definition Framework (RDF) - Web Service Definition Language (WSDL) - C# Application Markup Language (CSAML) - Extensible Application...
0
by: jhansen | last post by:
I am getting informational warnings about the following app.config and indicate the following. I am using C# visual studio 2005 and used the Settings.settings to set up my values scoped as...
3
by: stefan.rickfjord | last post by:
Hi, I am a newbie to programming using XML and I'm currently working on a side-project which will house some database information in a XML-file. I am writing a DTD to specify the XML-format,...
8
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
2
by: tshad | last post by:
I have been using a schema.ini file to define the columns of my .csv files that has been working fine. But I just tried one where it doesn't work. I have the following schema.ini file: ...
3
by: Water Cooler v2 | last post by:
Sorry for asking this beginner question. I've written DTDs so far and read about XML Schemas. I understand that they are a replacement of the DTD fundamentally, and therefore allow for the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.