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

Re: Create a special purpose programming language, in XML,usin

  • From: Stephen D Green <stephengreenubl@gmail.com>
  • To: "Costello, Roger L." <costello@mitre.org>
  • Date: Fri, 18 Oct 2013 10:03:54 +0100

Re:  Create a special purpose programming language
I worked in an OASIS TC on a scripting language we called
XTemp. All the usual features such as for-loops and if-else
conditions were included. It has an XSLT compiler which 
compiles it to XSLT which is run against XML input.
It is in some ways domain specific in that it was specifically
designed (originally as part of ebXML) for testing/monitoring event
logs of business processes such as EDI XML. It is interesting
how such a procedural scripting language can convert to
declarative XSLT, using XSLT for the conversion / compilation.
It seems worth a look at how such languages evolve. I would
have thought that there would be more study of the microcosm
we get with XML language evolution which might be a present
day repetition of the history of programming language evolution
as whole. As such I agree with Michael Kay's observation in
that going forward the way programming languages moved in
the past left GOTO statements behind. Will programming
languages based on XML actually continue to evolve though?
If so will they progress from procedural to object oriented?
It is interesting how popular declarative languages written
in XML have been and yet people like to do the programming
itself with something procedural. Perhaps a language like
Java can be compiled to XSLT too? (For when the input is XML.)
Many people who write 'normal' code seem to like to keep
XML hidden out of sight. It's there in the background still but
their code gets written without it. At least if you have an
intermediate language compiled as XSLT which has for loops
and if/else statements then maybe the next step will be to
wrap that in a 'normal' language like Java so programmers
don't have to see XML.

----
Stephen D Green


On 17 October 2013 22:39, Costello, Roger L. <costello@mitre.org> wrote:
Hi Folks,

Occasionally I find that I need to create a special-purpose programming language, to be used to describe how to process XML documents.

In creating the language I would mimic other programming languages such as Java, e.g.,

        <if>
            <condition>...</condition>
        <then>
            <action>...</action>

and

        <while>
            <condition>...</condition>
        <do>
            <action>...</action>

Then I would write an interpreter (using XSLT) to interpret "programs" written in my new programming language.

However, I recently realized that there is another approach. This illustrates the approach:

<Machine>
    <TransitionRules>
        <Transition currentState="Number" read="0" write="0"
                            nextState=Number" />
        <Transition currentState="Number" read="1" write="1"
                            nextState=Number" />
        <Transition currentState="Number" read=" " write="0"
                            nextState=Halt" />
    </TransitionRules>
</Machine>

Instructions and algorithms are expressed using state transition rules.

The neat thing about this approach is:

(1) It is very regular. I don't need to invent a bunch of new elements, such as <if> and <while>.

(2) It is very powerful - it can express any algorithm [1].

(3) No need to constantly extend the language to support new features.

I was inspired to this approach after reading this fantastic article [2], which represents Turing Machines in XML.

Have you created your own special purpose programming language, formatted as XML? If so, what approach did you take to create your language?

/Roger

[1] You may recognize that this is essentially a Turing machine. Turing machines are known to be capable of expressing any algorithm.

[2] See section 2 of:
http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=F9BABBA74FAEC3276C5DEBC8CC756775?doi=10.1.1.100.3032&rep=rep1&type=pdf

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.