[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Schema for Programming Language

  • To: xml-dev@l...
  • Subject: Schema for Programming Language
  • From: Allen Razdow <arazdow@m...>
  • Date: Wed, 14 May 2003 17:37:01 -0400

schema programming language

I'm writing a schema to represent documents which are programs in a particular programming language.  The most useful part of the schema would represent the "abstract syntax" of the program, essentially a canonical form of the program stripped of concrete syntax and sugar.  But can anyone give guidance on accepted or conventional ways to include the specific syntax/sugar in the schema in a way that keeps it separate somehow?

 

For example, consider the code-fragment :

 

     If (x<0)

            ++x;

     else

            --x;

 

Something like

 

<if-then-else-statement>

            <block>

                        <unary-op type="increment" arg="x"/>

            </block>

            <block>

                        <unary-op type="decrement" arg="x"/>

            </block>

</if-then-else-statement>

 

could represent the abstract syntax of the fragment, but doesn't capture the actual syntax with the programmers choices for indenting, etc.  The specific operator syntax such as "++" can be generated with XSLT because it is part of the language, but what about the whitespace, indenting and linebreaks?  Where should they appear in the XML of the fragment?  Having two separate schemata, echoing the program and its parse-tree, seems wrong.  XML should be able to annotate the parse-tree with the syntactic specifics somehow.

 

Any advice would be appreciated.

 

-Allen


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.