473,804 Members | 3,156 Online
Bytes | Software Development & Data Engineering Community
+ 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",$to ken) | 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 1532
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
1930
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 Oracle's documentatino for 9iR2 that if you want to store schema based XML documents in Oracle, you first have to register the schema. The problem is that if you want to modify the schema, and then subsequently re-register it Oracle will force you to...
2
2409
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> <ipaddress>1.2.3.4</ipaddress> <hostname>qwerty</hostname> <dnsserver>7.7.7.7</dnsserver> </networkinfo>
6
4434
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 when they run the app? If so, what should I do if I can't guarantee that they will be? Can I bring all these files into the app? Is that desirable? I'm about to write an app that takes an XML file as input, using Visual Studio 2005 Express and SQL...
3
1831
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 Markup Languaeg (XAML) - Or, HTML itself? Are these not specific vocabularies? OK, HTML may not have very rigid
0
7816
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 application. How do I clear up these informational warnings? The 'requirePermission' attribute is not declared. Could not find schema information for the element 'applicationSettings.' Could not find schema information for the element...
3
1199
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, mostly for the purpose of documenting the XML database. My issue is that I have some fields, e.g. <!ELEMENT Vehicle ( Car? )> <!ELEMENT Car ( Gasoline | Diesel )>
8
2755
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 the sequence nos and it should be such that i can access it through the structure .plz help me .
2
5842
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: *********************************************************** Format=CSVDelimited
3
3674
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 validation of an XML document. My question really is: Why do we need XML Schemas other than for validation of an XML document? I am more interested in knowing if already available
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10330
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7616
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
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 we have to send another system
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.