comp.lang.ada
 help / color / mirror / Atom feed
From: Manuel Collado <m.collado@domain.invalid>
Subject: Re: Any Ada source XML serialization standard?
Date: Mon, 09 Apr 2012 23:25:04 +0200
Date: 2012-04-09T23:25:04+02:00	[thread overview]
Message-ID: <jlvk3a$l0i$1@speranza.aioe.org> (raw)
In-Reply-To: op.wceg0wjcule2fv@douda-yannick

El 07/04/2012 16:54, Yannick Duchêne (Hibou57) escribió:
> Hi Peter,
>
> Le Fri, 06 Apr 2012 21:01:46 +0200, Peter C. Chapin <PChapin@vtc.vsc.edu> a
> écrit:
>
>> On 2012-04-06 13:54, Yannick Duchêne (Hibou57) wrote:
>>
>>> I read about a so called cppML, whose purpose was precisely that, but
>>> for C++. As there use to be a cppML, I naively searched for an adaML or
>>> some sort of that, but failed. By the way, this cppML seems dead, or am
>>> I wrong?
>>
>> I wonder if one could hijack ASIS for this purpose. That is, define an
>> XML representation of Ada source using XML elements with names that
>> correspond to ASIS elements. Such an approach might allow a certain
>> amount of "mindshare" between the two systems. A person familiar with
>> ASIS could easily understand the XML representation or visa-versa.
>
> ASIS adds interpretation, while an XML representation of Ada source should
> not. There are, in the Ada language, some intentional ambiguities, like the
> famous one which allow to write the same way, a function invocation and a
> reference to an array element. It's a long time I did not play with ASIS,
> however if my mind is right, for ASIS, “E (F)” is not same when E is a
> function or an array.
>
> Using the BNF grammars terms as found in the RM, may not always be OK for
> the same reasons (as the terms refers to interpretations), while it seems
> to be the best starting point. If the RM could explicitly point intentional
> ambiguities and provides names for these intentionally ambiguous source
> constructs, this would be an aid.
>
> The purpose is to get ride of formating (would be automatically applied by
> the view depending on user own preferences) and to be able to easily access
> to source as structured data. With the addition of XML namepaces to be able
> to add meta‑data more handily than with bloated comments and mini‑languages
> in comments, to allow filtered view, outlining, and other things, and my
> favorite one: cross references between sources and documentations.
>
> This is language neutral, there is no complaints about Ada here ;) Just
> that such a standard would be welcome and would not cost too much I believe.
>
> If you forgive me a bit of out‑of‑topic for an Ada Usenet, here are the
> readings I could find on the topic:
>
> [Source Code Files as Structured
> Documents](http://www.sdml.info/papers/iwpc02.pdf)
> [Towards Portable Source Code Representations Using
> XML](http://www.sdml.info/library/Mamas00.pdf)
>
> There was a now abandoned close research area, named Intentional
> Programming. But this differs in many points and the above is far less
> specific.

I've worked in the area of representing source code as XML for years. 
Please see:

   http://lml.ls.fi.upm.es/~mcollado/emu-code/emu-code-other.html

(a bit outdated, but probably still a useful compilation)

IMHO, there is no such thing as "the standard" XML representation of code 
for a given programming language. A naive approach would be to mimic the 
usual grammar of the language (if there is one). But to be useful, the 
chosen representation should take into account its intended usage (code 
navigation, automatic transformation, manual editing, etc.)

In some cases, representing the syntax is not enough. Some semantic 
information can also be included in the representation. For instance, the 
Intentional Programming approach includes also references from each 
identifier usage to the identifier definition, so overloaded symbols are 
explicitly disambiguated.

Even in the simple code formatting task you mention, some semantic 
distinction can be useful. For instance, function_F(x,y,z) and 
array_A(x,y,z) could be formatted differently, as well as distinguishing 
local and global identifiers with different color by a syntax highlighter 
for code browsing purposes.

Hope this helps.
-- 
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado




      reply	other threads:[~2012-04-09 21:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-06 17:54 Any Ada source XML serialization standard? Yannick Duchêne (Hibou57)
2012-04-06 19:01 ` Peter C. Chapin
2012-04-06 21:41   ` Simon Wright
2012-04-07 14:54   ` Yannick Duchêne (Hibou57)
2012-04-09 21:25     ` Manuel Collado [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox