From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1605aa6456956e3c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.68.202.37 with SMTP id kf5mr8001083pbc.7.1334006704455; Mon, 09 Apr 2012 14:25:04 -0700 (PDT) Path: r9ni37877pbh.0!nntp.google.com!news2.google.com!goblin3!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: Manuel Collado Newsgroups: comp.lang.ada Subject: Re: Any Ada source XML serialization standard? Date: Mon, 09 Apr 2012 23:25:04 +0200 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: bm2XTViJCYlBEyK7Qi+nVw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20120312 Thunderbird/11.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: 2012-04-09T23:25:04+02:00 List-Id: 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 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