473,808 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programming language + XML + XSL = compiler ?

Hi folks

New around here. This post may be a duplicate, I think I bungled the
previous one.

I've recently started out with XML and XSL and I'm very impressed with
both. My use is non-web in nature. In fact, I'm writing a compiler of
sorts, from high-level spec in XML, with eventual generation of VHDL.

I've made the following observations:

1. Given pure source code (Eg:Java,C++), one could generate an abstract
syntax tree in XML.
2. XML is also apposite for symbol tables and intermediate froms.
3. XSLT can do powerful transformations of said internediate forms.
4. XSL can generate plain text.

I'm wondering wondering what it would take to implement a compiler for
a given language in XML/XSL. More specifically, are there any XSL or
XML based systems that assist in scanning pure source into XML so that
the transformations can begin? Grammar could be provided in marked-up
EBNF. This is probably over-optimistic could the process would need
knowledge of LL/LALR etc.

The alternative approach is to use your standard scanner/parser
generator with it's own (non-interchangable) EBNF and have the action
code generate tagged tokens, giving you an AST in XML.

My questions:
1. Are there any decent XML shema's for EBNF?
2. Are there any tools / XSL extensions to do the above?
3. What are your thoughts on the whole idea?

Best regards,
Richard Brady

Jun 23 '06
19 1698
Another interesting reference on this topic: The folks working on a test
suite for the W3C's DOM APIs were developing a limited XML-based
"programmin g language" for binding/language-independent description of
the tests, together with stylesheets which would render those into
executable form. Again, that's a fairly primitive "compiler", but it's
yet another instance of XML-based programming languages.
Jun 26 '06 #11
Juergen
Where did you get the DSP algorithms in XML ?
That's a good question. I'm writing them myself and learning as I go
along.
Is there any standard for this ?


Not that I know of, but I wouldn't be surprised.

So, now that I have these XML descriptions being converted into VHDL,
the next step is to layer something more interesting on top. No DSP
designer wants to type their spec in XML ... yuk!

There are several options: text (something more readable than XML),
visual, or both. My application is Software Defined Radio so I'm
looking at Waveform Description Language (WDL) which has a textual form
with equivalent representations in visual and XML forms. Another option
would be UML2.

For WDL I have a Lex/Yacc grammar, so I can just create a little
compiler to mark-up the code. I thought there'd be plenty other folk
with the same issue and some standard solution might have been
developed. I'm a big fan of standard solutions because of the re-use
which they encourage.

Richard

Jun 26 '06 #12
Juergen

PS: Your links (both the article and the comp.compiler discussion) were
very useful. Thank you.

Jun 26 '06 #13
rn*****@gmail.c om wrote:
So, now that I have these XML descriptions being converted into VHDL,
the next step is to layer something more interesting on top. No DSP
designer wants to type their spec in XML ... yuk!
Two years ago, someone posted here about a VHDL
application. Use Google Newsgroups to search for
"Use variables to get unique nodes". He posted
this stuff:

<?xml version="1.0" encoding="UTF-8"?>
<Root>
<E>
<!-- If we have the key match with pin only
the xslt does not work. If the maych is at least TEST/Pin
it is OK
-->
<Pin PinName="A" PinClass="T"/>
<!--<Pin PinName="AX" PinClass="T"/> -->
</E>
<x>
<!-- in case the TEST node below is not selected by Index
AND PinName="A" and CellType="M" matches
the result is wrong
-->
<TEST Index="42" CellType="M">
<Pin PinName="z" PinClass="R"/>
<!--<Pin PinName="AX" PinClass="T"/>-->
<Pin PinName="A" PinClass="T"/>
</TEST>
<TEST Index="43" CellType="M">
<Pin PinName="A" PinClass="T"/>
<Pin PinName="D" PinClass="R"/>
<Pin PinName="C" PinClass="R"/>
<Pin PinName="X" PinClass="R"/>
</TEST>
<TEST Index="44" CellType="M">
<Pin PinName="D" PinClass="R"/>
<Pin PinName="C" PinClass="R"/>
<Pin PinName="X" PinClass="R"/>
<Pin PinName="A" PinClass="T"/>
</TEST>
<TEST Index="45" CellType="M">
<Pin PinName="z" PinClass="R"/>
</TEST>
</x>
</Root>

There are several options: text (something more readable than XML),
visual, or both. My application is Software Defined Radio so I'm
looking at Waveform Description Language (WDL) which has a textual form
with equivalent representations in visual and XML forms. Another option
would be UML2.


This is rather abstract. You should post an example.
Jun 26 '06 #14
rn*****@gmail.c om wrote:
PS: Your links (both the article and the comp.compiler discussion) were
very useful. Thank you.


This paper about lcc may also be interesting for you:

http://www.cs.princeton.edu/software/lcc/asdl.html

This is not strictly involving XML, but they also
use a tree-representation.
Jun 26 '06 #15
Thanks!

Jun 28 '06 #16
I recently came across the str:tokenize() function at the EXSLT
project. It takes a string and converts it into several tokens.

QUOTE:

The string given by the first argument is split at any occurrence of
any of these characters. For example:

str:tokenize('2 001-06-03T11:40:23', '-T:')
Gives the node set consisting of:

<token>2001</token>
<token>06</token>
<token>03</token>
<token>11</token>
<token>40</token>
<token>23</token>

UNQUOTE.

This is close to what I had in mind. If you could extend the idea so
that it takes an EBNF in XML form instead of a list of delimiters,
wouldn't you have part of a scanner and parser?

Jun 29 '06 #17
rn*****@gmail.c om wrote:
This is close to what I had in mind. If you could extend the idea so
that it takes an EBNF in XML form instead of a list of delimiters,
wouldn't you have part of a scanner and parser?


Yes, but what is it good for ?
Do you want to write a universal Parser which
takes an EBNF and parses according to the EBNF ?
Such universal parsers have been suggested and
implemented much earlier. For example, Niklaus
Wirth presented such a parser in 1976:

http://www.inf.ethz.ch/personal/wirt.../Compilerbau0/
http://www.oberon.ethz.ch/WirthPubl/CBEAll.pdf
Jun 30 '06 #18
Do you want to write a universal Parser which
takes an EBNF and parses according to the EBNF ?
It doesn't need to be written from scratch, just integrated as an
extension to XSL, so that XSL can take structured text (in a non-XML
form) as input and parse it, and generate xml/html/text as output.
Yes, but what is it good for ?
1. Compiler-compiler not needed as separate step in the whole process.
2. Definition of a standard syntax for EBNF using a DTD or XSD.
3. Entire compiler could be written in XSL.
4. An interesting platform for academic exploration of compiler design.

Jul 3 '06 #19
Andy Dingley <di*****@codesm iths.comwrote:
Joe Kesselman wrote:
>>Hm. I don't usually think of Ant as a programming language,


In its limited little way, it's a declarative programming language (as
was Prolog). You can use it as a convenient dependency resolver.

>>I don't think I've heard of anyone styling it,


I have an XSLT stylesheet that auto-documents Ant external targets.
Handy when I'm shipping deployment scripts to users.

I also auto-generate Ant from a vile combination of our bug tracker,
change control, and Torque repository. This generates database patch
scripts for upgrading customer databases from arbitrary start points to
new product versions.
hi,

I have designed and implemented a general-purpose XML system that I
called "Active Tags" which allows to make programs with XML tags ; it
allows to mix declarative tags with imperative instructions, uses XPath
to access object's properties, and much more...

it is not "yet another markup language" but a framework that allows
several markup languages to run together

the implementation (Java) :
http://reflex.gforge.inria.fr
the specs :
http://disc.inria.fr/perso/philippe....tive-tags.html
http://disc.inria.fr/perso/philippe....l/active-tags/

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
-----------------------------
http://reflex.gforge.inria.fr/
Have the RefleX !
Jul 3 '06 #20

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

Similar topics

34
2696
by: nobody | last post by:
This article is posted at the request of C.W. Yang who asked me to detail my opinion of Lisp, and for the benefit of people like him, who may find themselves intrigued by this language. The opinions expressed herein are my personal ones, coming from several years of experience with Lisp. I did plenty of AI programming back in the day, which is what would now be called "search" instead.
32
2827
by: cat_dog_ass | last post by:
I am used to programming in DOS mode via Borland C++. I would now like to create programs for the Windows envirinment. Is it absoultely necessary to use Visual C++ to do this? Are there other tools that can help me in doing Windows programming via C++? How am I going to create drop-down menus and allow my programs to interact with the mouse? Regards, Icon
134
8053
by: evolnet.regular | last post by:
I've been utilising C for lots of small and a few medium-sized personal projects over the course of the past decade, and I've realised lately just how little progress it's made since then. I've increasingly been using scripting languages (especially Python and Bourne shell) which offer the same speed and yet are far more simple and safe to use. I can no longer understand why anyone would willingly use C to program anything but the lowest...
22
13721
by: Matt | last post by:
Some people identify Microsoft C# is Proprietary programming language. What is Proprietary programming language then? How does it differ from other languages such as C++, or Java?? Please advise. thanks!!
3
5402
by: Visually Seen # | last post by:
Hey everybody, I want to create my own programming language, using C#. Could anyone give me some tips, advice on this goal? Let's say that in my programming language uses the keyword, integer instead of int. Thanks, Seen Sharp
29
2263
by: SG | last post by:
Hi everyone, I am a complete novice at computers and programming and right now, all i need to know is that why do many people prefer C to C++? Is it just because they are used to using C and are conservative about switching over to C++ or is there some other reason? Secondly, could you please tell me how the knowledge of C will help me later on? I have a teacher here who just shrugged at this question and replied that the knowledge of...
139
6009
by: Joe Mayo | last post by:
I think I become more and more alone... Everybody tells me that C++ is better, because once a project becomes very large, I should be happy that it has been written in C++ and not C. I'm the only guy thinking that C is a great programming language and that there is no need to program things object oriented. Many people says also that they save more time by programming projects object oriented, but I think its faster to program them in a...
84
8610
by: aarklon | last post by:
Hi all, I found an interesting article here:- http://en.wikipedia.org/wiki/Criticism_of_the_C_programming_language well what do you guys think of this article....??? Is it constructive criticism that needs to be appreciated always...???
53
5270
by: Vicent Giner | last post by:
Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming language —I mean, it is not like C, in that sense. I am working on my PhD Thesis, which is about Operations Research,
43
3703
by: Adem24 | last post by:
The World Joint Programming Language Standardization Committe (WJPLSC) hereby proclaims to the people of the world that a new programming language is needed for the benefit of the whole mankind in the 21st millenium. This new language not only differs from existing ones by new features and paradigms but which also brings real advantage by rigourously preventing bad programmer habits by omitting features which are outdated. In the proposed...
0
9721
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
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10628
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...
1
10374
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9195
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5547
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
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
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
3011
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.