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

Home Posts Topics Members FAQ

Any XML standards for code grammar?

I am written a program that will be used to parse the lexical syntax of code
files. I would like to generalize the grammar logic so that I don't
hardcode any specific grammar in my program. Basically I would like to use
XML to define a languages grammar the way that BNF does. Are there any
standard XML format for defining a languages grammar?


Nov 11 '05 #1
2 1758
Any chance you can express the grammar as a schema? There are several
competing schema standards, XML Schema (also referred to as XSD) seems to be
the more popular one, but maybe others (DTD, Schematron, Relax-NG) may suit
your needs better.

--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
I am written a program that will be used to parse the lexical syntax of code files. I would like to generalize the grammar logic so that I don't
hardcode any specific grammar in my program. Basically I would like to use XML to define a languages grammar the way that BNF does. Are there any
standard XML format for defining a languages grammar?

Nov 11 '05 #2
You misunderstand.

Similar to the way that different industries have developed XML structures
for their needs (e.g. VoiceXML, MathXML, etc.) I was wondering if the
software industry any standard way to represent BNF form in XML.

It is much easier to parse an XML file than it is to parse a text file.

For instance, I would like to have a system that reads something like the
following:
<statement name="x">
<statement name="inner">
<token value="somevalue"/>
...

which in BNF would look something like:
x ::= <inner>
inner ::= somevalue
....

I want to be able to express the computer language's grammar in XML format
rather than BNF. Before I attempted to define the XML structure that I
would use, I was hoping that there were already proposed standards for this.

"Christoph Schittko [MVP]" <ch********************@austin.rr.com> wrote in
message news:uv**************@TK2MSFTNGP12.phx.gbl...
Any chance you can express the grammar as a schema? There are several
competing schema standards, XML Schema (also referred to as XSD) seems to be the more popular one, but maybe others (DTD, Schematron, Relax-NG) may suit your needs better.

--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
I am written a program that will be used to parse the lexical syntax of

code
files. I would like to generalize the grammar logic so that I don't
hardcode any specific grammar in my program. Basically I would like to

use
XML to define a languages grammar the way that BNF does. Are there any
standard XML format for defining a languages grammar?


Nov 11 '05 #3

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

Similar topics

5
by: Peri | last post by:
I'm trying to create Python parser/interpreter using ANTLR. Reading grammar from language refference I found: or_expr::= xor_expr | or_expr "|" xor_expr For me it looks like infinite recursion....
1
by: Karalius, Joseph | last post by:
Can anyone explain what is happening here? I haven't found any useful info on Google yet. Thanks in advance. mmagnet:/home/jkaralius/src/zopeplone/Python-2.3.5 # make gcc -pthread -c...
0
by: Bengt Richter | last post by:
We have where syntax in combination with suite expression syntax (bear with me, I think a good synergy will emerge ;-) ...
250
by: Sugapablo | last post by:
Just out of curiosity, while checking on a site I was working on, I decided to throw a couple of the web's most popular URLs into the W3C Markup Validator. Out of microsoft.com, google.com,...
144
by: Natt Serrasalmus | last post by:
After years of operating without any coding standards whatsoever, the company that I recently started working for has decided that it might be a good idea to have some. I'm involved in this...
3
by: junky_fellow | last post by:
I got one link to the ANSI C Grammar http://www.lysator.liu.se/c/ANSI-C-grammar-y.html However, I don't know how to understand this grammar. I am not a Computer Science Guy. Can anybody please...
2
by: Bhupesh Naik | last post by:
This is a query regarding my problem to make a spell and grammar check possible in text area of a web page. We have aspx pages which are used to construct letters. The browser based screens...
5
by: Remco van Engelen | last post by:
Hello, I have a question regarding the ISO C grammar. The syntax of a direct-declarator reads (section A.2.2, page 413 in my copy; the (R1) is just to 'name' the rule for later reference): ...
10
by: MBR | last post by:
Hello... I'm using the grammar at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/vclrfcsharpspec_c.asp as a reference in creating my own C# parser using a custom...
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
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...
0
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,...
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
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...
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.