Groups | Blog | Home
all groups > dotnet xml > september 2003 >

dotnet xml : Any XML standards for code grammar?


Peter Rilling
9/27/2003 6:20:45 PM
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?



Christoph Schittko [MVP]
9/29/2003 10:29:59 PM
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

[quoted text, click to view]

Peter Rilling
10/1/2003 1:45:51 PM
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]" <christophdotnetINVALID@austin.rr.com> wrote in
message news:uv9JsMwhDHA.2408@TK2MSFTNGP12.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button