comp.lang.ada
 help / color / mirror / Atom feed
* ANNOUNCE: Avatox 1.0 is now available
@ 2006-08-17  0:58 Marc A. Criley
  2006-08-17  2:10 ` Jeffrey Creem
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Marc A. Criley @ 2006-08-17  0:58 UTC (permalink / raw)


Avatox 1.0 (Ada, Via Asis, To Xml) is an application that traverses an Ada 
compilation unit and outputs the ASIS representation of that unit 
structured as an XML document.

It is now available in source code form at www.mckae.com/avatox.html.

Avatox' XML representation provides some content, such as identifier names 
and operators, as attributes, rather than outputting everything as an 
element.  It also outputs the row/column span of every element, and embeds 
comment lines within non-ASIS "A_COMMENT" elements.

Here's a brief excerpt generated by:

   avatox avatox.adb -Imckae -I$GNAT/include/asis

(assuming GNAT is the GNAT GPL 2006 installation directory)


<A_DECLARATION startLine="47" endLine="299" startCol="1" endCol="11">
   <A_PROCEDURE_BODY_DECLARATION startLine="47" endLine="299"
                                 startCol="1" endCol="11">
   </A_PROCEDURE_BODY_DECLARATION>
   <A_DEFINING_NAME startLine="47" endLine="47" startCol="11" endCol="16">
     <A_DEFINING_IDENTIFIER name="Avatox" startLine="47" endLine="47"
                                          startCol="11" endCol="16"/>
   </A_DEFINING_NAME>

The canonical style of XML element naming can also be selected for ASIS 
element naming, which alters the previous excerpt to look like this:

<aDeclaration startLine="47" endLine="299" startCol="1" endCol="11">
   <aProcedureBodyDeclaration startLine="47" endLine="299"
                              startCol="1" endCol="11">
   </aProcedureBodyDeclaration>
   <aDefiningName startLine="47" endLine="47" startCol="11" endCol="16">
     <aDefiningIdentifier name="Avatox" startLine="47" endLine="47"
                                        startCol="11" endCol="16"/>
     </aDefiningName>


So what can you do with Avatox?

Well, you can now leverage XML technologies, like XPath and XQuery, for 
source code metrics and analysis.

There's enough information in the generated XML representation that one 
should be able to identically reconstitute the original Ada source code. 
And should such a utility come into existence <grin>, one could even do 
things like XSLT based transformations on the XML and generate Ada source 
code from the resulting file.

Avatox 1.0 was developed using GNAT GPL 2006, and is an evolution of the 
Display_Source program distributed with that compiler's ASIS distribution. 
  Avatox is therefore licensed under the GPL, while the included McKae 
software utilites is licensed as GMGPL.

Check it out at www.mckae.com/avatox.html. (And yes, I know the title 
graphic is missing, it's on order :-)

-- Marc A. Criley
-- Mckae Technologies
-- www.mckae.com
-- DTraq - Avatox - XIA - XML EZ Out




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-08-17  0:58 ANNOUNCE: Avatox 1.0 is now available Marc A. Criley
@ 2006-08-17  2:10 ` Jeffrey Creem
  2006-08-18  8:03 ` Pascal Obry
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Jeffrey Creem @ 2006-08-17  2:10 UTC (permalink / raw)


Marc A. Criley wrote:
> Avatox 1.0 (Ada, Via Asis, To Xml) is an application that traverses an 
> Ada compilation unit and outputs the ASIS representation of that unit 
> structured as an XML document.
> 
> It is now available in source code form at www.mckae.com/avatox.html.
> 

Great job.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-08-17  0:58 ANNOUNCE: Avatox 1.0 is now available Marc A. Criley
  2006-08-17  2:10 ` Jeffrey Creem
@ 2006-08-18  8:03 ` Pascal Obry
  2006-08-18  8:04 ` Pascal Obry
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Pascal Obry @ 2006-08-18  8:03 UTC (permalink / raw)
  To: Marc A. Criley

Marc A. Criley a �crit :

> There's enough information in the generated XML representation that one
> should be able to identically reconstitute the original Ada source code.
> And should such a utility come into existence <grin>, one could even do
> things like XSLT based transformations on the XML and generate Ada
> source code from the resulting file.

What about generating C++ from this XML file ? We would have a free
Ada->C++ converter for target missing an Ada compiler, or for political
reasons ;)

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-08-17  0:58 ANNOUNCE: Avatox 1.0 is now available Marc A. Criley
  2006-08-17  2:10 ` Jeffrey Creem
  2006-08-18  8:03 ` Pascal Obry
@ 2006-08-18  8:04 ` Pascal Obry
  2006-08-18  8:05 ` Pascal Obry
  2006-08-21 20:59 ` Simon Wright
  4 siblings, 0 replies; 18+ messages in thread
From: Pascal Obry @ 2006-08-18  8:04 UTC (permalink / raw)
  To: Marc A. Criley

Marc A. Criley a �crit :

> There's enough information in the generated XML representation that one
> should be able to identically reconstitute the original Ada source code.
> And should such a utility come into existence <grin>, one could even do
> things like XSLT based transformations on the XML and generate Ada
> source code from the resulting file.

What about generating C++ from this XML file ? We would have a free
Ada->C++ converter for target missing an Ada compiler, or for political
reasons ;)

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-08-17  0:58 ANNOUNCE: Avatox 1.0 is now available Marc A. Criley
                   ` (2 preceding siblings ...)
  2006-08-18  8:04 ` Pascal Obry
@ 2006-08-18  8:05 ` Pascal Obry
  2006-08-21 20:59 ` Simon Wright
  4 siblings, 0 replies; 18+ messages in thread
From: Pascal Obry @ 2006-08-18  8:05 UTC (permalink / raw)


Marc A. Criley a �crit :

> There's enough information in the generated XML representation that one
> should be able to identically reconstitute the original Ada source code.
> And should such a utility come into existence <grin>, one could even do
> things like XSLT based transformations on the XML and generate Ada
> source code from the resulting file.

What about generating C++ from this XML file ? We would have a free
Ada->C++ converter for target missing an Ada compiler, or for political
reasons ;)

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-08-17  0:58 ANNOUNCE: Avatox 1.0 is now available Marc A. Criley
                   ` (3 preceding siblings ...)
  2006-08-18  8:05 ` Pascal Obry
@ 2006-08-21 20:59 ` Simon Wright
  2006-08-24  0:41   ` Marc A. Criley
  4 siblings, 1 reply; 18+ messages in thread
From: Simon Wright @ 2006-08-21 20:59 UTC (permalink / raw)


This is excellent news. I think I shall still carry on with my own
asis2xml (under
http://gnat-asis.sourceforge.net/pmwiki.php/Main/ASIS2XML, no releases
as yet) for a while.

I took the view that <A_DEFINING_NAME/> would look better as
<defining_name/> throughout.

There are also some interesting choices about which aspects to map
into attributes and which into child elements, and indeed on the whole
mapping to be used.

Do you support multi-unit environments?

Do you think there'd be a future in offering at least the concept to
the ASIS team?

As a demo of the sort of thing one can do, we found it pretty
straightforward to generate a report on all the exception handlers in
our application which capture non-generated exceptions, so that we
could review whether the logging being done was appropriate. The XML
for the application was >50MB, but the performance was pretty
reasonable (of order a minute to generate the report; generating the
XML took rather longer).

The guts of the XSLT report script (not at all perfect, but good
enough, and excluding some extra rules for tasks) was

  <xsl:template match="*[@unit]" mode="handlers">
    <!-- Skip 'raise ColdFrame.Exceptions.*'. -->
    <xsl:if test=".//exception_handler
                  [not(raise_statement//identifier='ColdFrame'
                  and raise_statement//identifier='Exceptions')]">
      <tr>
        <td>
          <xsl:value-of select="@unit"/>
        </td>
        <td>
          <xsl:if test=".//exception_handler[not(raise_statement)]">
            <xsl:text>Yes</xsl:text>
          </xsl:if>
        </td>
      </tr>
    </xsl:if>
  </xsl:template>

which says "for every unit that has an exception handler in it at some
level of nesting that doesn't raise one of the generated exceptions,
output a table row containg the unit name and, if the exception
handler doesn't contain a raise statement, the word 'Yes'".



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-08-21 20:59 ` Simon Wright
@ 2006-08-24  0:41   ` Marc A. Criley
  2006-08-24  6:03     ` Simon Wright
  0 siblings, 1 reply; 18+ messages in thread
From: Marc A. Criley @ 2006-08-24  0:41 UTC (permalink / raw)


Simon Wright wrote:
> I took the view that <A_DEFINING_NAME/> would look better as
> <defining_name/> throughout.

I try to adopt the prevailing style and idioms of a given programming or 
similar such language, hence the camelBack no underscore approach.

> There are also some interesting choices about which aspects to map
> into attributes and which into child elements, and indeed on the whole
> mapping to be used.

Basically, I mapped literals into attributes, like identifiers, operators, 
numbers, and such.

There are other possibilities, but I didn't want to have to maintain any 
kind of info stack to know what value to associate with a previous or 
subsequent element.  Like A_CLAUSE could've had the kind of clause--"with", 
"usePackage"--as an attribute.  Here it's all done in a single pass with no 
look back or look-ahead.

> Do you support multi-unit environments?

The current release of Avatox only processes the single compilation unit 
provided to it.  Extending that to a closure probably wouldn't be that hard.

The Avatox XML Format (AXF) would support multiple units as-is (v1.1 and 
beyond), you just keep adding them in.

> Do you think there'd be a future in offering at least the concept to
> the ASIS team?

I'm a little unclear on what concept you're referring to...an XML 
definition for Ada?

> As a demo of the sort of thing one can do, we found it pretty
> straightforward to generate a report ...

<snip>

The analysis and reporting aspect is definitely one area for Avatox, using 
stylesheets just as you've done.

My focus though is more on "Transformation & Vivification", i.e., 
transforming the XML representation using <buzzword>XML-enabled 
technologies</buzzword> and then bringing the result to life by some means, 
whether that be converting the XML back to Ada source code, or compiling it 
directly, or through some other animation.

I'm experimenting and watching to see where this goes...

-- Marc A. Criley
-- Mckae Technologies
-- www.mckae.com
-- DTraq - Avatox - XIA - XML EZ Out




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-08-24  0:41   ` Marc A. Criley
@ 2006-08-24  6:03     ` Simon Wright
  2006-08-25  1:15       ` Marc A. Criley
  2006-09-06 23:29       ` Randy Brukardt
  0 siblings, 2 replies; 18+ messages in thread
From: Simon Wright @ 2006-08-24  6:03 UTC (permalink / raw)


"Marc A. Criley" <mcNOSPAM@mckae.com> writes:

> Simon Wright wrote:
>> I took the view that <A_DEFINING_NAME/> would look better as
>> <defining_name/> throughout.
>
> I try to adopt the prevailing style and idioms of a given programming
> or similar such language, hence the camelBack no underscore approach.

Not so sure there is a prevailing sytle or idiom for XML!

>> There are also some interesting choices about which aspects to map
>> into attributes and which into child elements, and indeed on the whole
>> mapping to be used.
>
> Basically, I mapped literals into attributes, like identifiers,
> operators, numbers, and such.

I thought traits were particularly interessting:

   --  Traits (see Asis spec) are an additional classification
   --  mechanism that lets Asis use fewer high-level elements. Not
   --  every A_Definition element supports traits, and not every trait
   --  is applicable in all circumstances. This code assumes that the
   --  Asis tree is well-formed, so if a trait is present it is legal
   --  and we just add the corresponding attribute to the DOM tree.
   procedure Add_Trait (K : Asis.Trait_Kinds; To : DOM.Core.Node) is
   begin
      case K is
         when Asis.Not_A_Trait | Asis.An_Ordinary_Trait => null;
         when Asis.An_Aliased_Trait =>
            DOM.Core.Elements.Set_Attribute (To, "aliased", "true");
         when Asis.An_Access_Definition_Trait =>
            DOM.Core.Elements.Set_Attribute (To, "access", "true");
         when Asis.A_Reverse_Trait =>
            DOM.Core.Elements.Set_Attribute (To, "reverse", "true");
         when Asis.A_Private_Trait =>
            DOM.Core.Elements.Set_Attribute (To, "private", "true");
         when Asis.A_Limited_Trait =>
            DOM.Core.Elements.Set_Attribute (To, "limited", "true");
         when Asis.A_Limited_Private_Trait =>
            DOM.Core.Elements.Set_Attribute (To, "limited", "true");
            DOM.Core.Elements.Set_Attribute (To, "private", "true");
         when Asis.An_Abstract_Trait =>
            DOM.Core.Elements.Set_Attribute (To, "abstract", "true");
         when Asis.An_Abstract_Private_Trait =>
            DOM.Core.Elements.Set_Attribute (To, "abstract", "true");
            DOM.Core.Elements.Set_Attribute (To, "private", "true");
         when Asis.An_Abstract_Limited_Trait =>
            DOM.Core.Elements.Set_Attribute (To, "abstract", "true");
            DOM.Core.Elements.Set_Attribute (To, "limited", "true");
         when Asis.An_Abstract_Limited_Private_Trait =>
            DOM.Core.Elements.Set_Attribute (To, "abstract", "true");
            DOM.Core.Elements.Set_Attribute (To, "limited", "true");
            DOM.Core.Elements.Set_Attribute (To, "private", "true");
      end case;
   end Add_Trait;

> There are other possibilities, but I didn't want to have to maintain
> any kind of info stack to know what value to associate with a previous
> or subsequent element.  Like A_CLAUSE could've had the kind of
> clause--"with", "usePackage"--as an attribute.  Here it's all done in
> a single pass with no look back or look-ahead.

I suppose that depends on your XML-generation toolset. But I don't
think you need to worry about what to associate, just suppress the
<A_CLAUSE/> element and output an <A_WITH_CLAUSE/> (or whatever).

>> Do you think there'd be a future in offering at least the concept to
>> the ASIS team?
>
> I'm a little unclear on what concept you're referring to...an XML
> definition for Ada?

I meant that ASISWG might be interested in 'sponsoring' a schema
definition working party (as informal as you like!). After all, at the
moment we have your schema and mine, each with advantages and
disadvantages, and on my side at least suffering from blind spots; for
example, it was only on comparing the two utilties' output that I
realised I'd completely forgotten about context clauses!

--S



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-08-24  6:03     ` Simon Wright
@ 2006-08-25  1:15       ` Marc A. Criley
  2006-09-06 23:29       ` Randy Brukardt
  1 sibling, 0 replies; 18+ messages in thread
From: Marc A. Criley @ 2006-08-25  1:15 UTC (permalink / raw)


Simon Wright wrote:

> Not so sure there is a prevailing sytle or idiom for XML!

Well, I go by the specs, the books, and what I see around, so that's how I 
settled on camelCase/no underscores.  YMMV :-)

> I suppose that depends on your XML-generation toolset. But I don't
> think you need to worry about what to associate, just suppress the
> <A_CLAUSE/> element and output an <A_WITH_CLAUSE/> (or whatever).

Well, it's the XML I want (and what proceeds from that starting point), and 
I don't care so much how it gets created, so long as it's a faithful and 
detailed representation of the original code.

> I meant that ASISWG might be interested in 'sponsoring' a schema
> definition working party (as informal as you like!). After all, at the
> moment we have your schema and mine, each with advantages and
> disadvantages, and on my side at least suffering from blind spots; for

Bring it to Clyde's attention, he still seems to be the ASIS guy.  While 
I'd like to have a schema, that's not my goal, though I'd be happy to 
review and comment during the process of developing one.

> example, it was only on comparing the two utilties' output that I
> realised I'd completely forgotten about context clauses!

So I'd noticed :-)  And hence, Avatox, which was quite simple to evolve 
from Display_Source.

-- Marc A. Criley
-- McKae Technologies
-- www.mckae.com
-- DTraq - Avatox - XIA - XML EZ Out




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-08-24  6:03     ` Simon Wright
  2006-08-25  1:15       ` Marc A. Criley
@ 2006-09-06 23:29       ` Randy Brukardt
  2006-09-07 20:46         ` Simon Wright
  1 sibling, 1 reply; 18+ messages in thread
From: Randy Brukardt @ 2006-09-06 23:29 UTC (permalink / raw)


"Simon Wright" <simon@pushface.org> wrote in message
news:m264giacw2.fsf@grendel.local...
...
> I meant that ASISWG might be interested in 'sponsoring' a schema
> definition working party (as informal as you like!).

Possibly, but the responsibility for updating ASIS has been assigned to the
ARG. And judging by the reactions of the ARG when we actually started
working on that, the result will be very different than (but largely
compatible with) the existing ASIS.

The primary problem was that ASIS supposedly stands for Ada Semantic
Interface Standard, but it is virtually impossible to write portable ASIS to
do anything with the semantics of an Ada program. (Only the syntax of the
program can be practically analyzed.) It is reported that determining
whether a type is limited takes 96 lines of Ada (ASIS) code - but this is a
property that every Ada compiler has a subprogram to calculate. It should be
directly available in ASIS. Moreover, virtually everything in ASIS is
currently optional, which makes writing ASIS programs that are portable very
difficult. Plus, the standard itself is poorly written, and it's
organization is such that it is arguable that ASIS users (not to mention
implementers) need a license from ISO. So we're going to be busy redoing the
entire standard.

ASISWG will provide some guidance, but the main work will be done by the ARG
and it's ASIS editors.

                                Randy.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-09-06 23:29       ` Randy Brukardt
@ 2006-09-07 20:46         ` Simon Wright
  2006-09-08  2:40           ` Randy Brukardt
  0 siblings, 1 reply; 18+ messages in thread
From: Simon Wright @ 2006-09-07 20:46 UTC (permalink / raw)


"Randy Brukardt" <randy@rrsoftware.com> writes:

> It is reported that determining whether a type is limited takes 96
> lines of Ada (ASIS) code - but this is a property that every Ada
> compiler has a subprogram to calculate. It should be directly
> available in ASIS.

Via Traits, yes? (which struck me as more than a bit of a kludge when
I grasped it). It takes me about 60 lines to process all the
possible/appropriate traits (assuming that the ASIS tree is
well-formed, so that if a declaration has an
Asis.An_Abstract_Limited_Private_Trait it's appropriate to mark it
abstract, limited and private).

I see that this isn't always quite obvious: I have

    type Request is limited private;

giving

    <private_type_declaration limited="true" private="true">
      <defining_identifier>Request</defining_identifier>
      <private_type_definition limited="true" private="true">
      </private_type_definition>
    </private_type_declaration>

which seems odd (I guess that the definition is of the anonymous type
of which the declaration is the first named subtype?)

> Moreover, virtually everything in ASIS is currently optional, which
> makes writing ASIS programs that are portable very difficult. Plus,
> the standard itself is poorly written, and it's organization is such
> that it is arguable that ASIS users (not to mention implementers)
> need a license from ISO. So we're going to be busy redoing the
> entire standard.

This sounds like good news.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-09-07 20:46         ` Simon Wright
@ 2006-09-08  2:40           ` Randy Brukardt
  2006-09-08 13:40             ` Georg Bauhaus
  0 siblings, 1 reply; 18+ messages in thread
From: Randy Brukardt @ 2006-09-08  2:40 UTC (permalink / raw)


"Simon Wright" <simon@pushface.org> wrote in message
news:m2u03jquay.fsf@grendel.local...
> "Randy Brukardt" <randy@rrsoftware.com> writes:
>
> > It is reported that determining whether a type is limited takes 96
> > lines of Ada (ASIS) code - but this is a property that every Ada
> > compiler has a subprogram to calculate. It should be directly
> > available in ASIS.
>
> Via Traits, yes? (which struck me as more than a bit of a kludge when
> I grasped it). It takes me about 60 lines to process all the
> possible/appropriate traits (assuming that the ASIS tree is
> well-formed, so that if a declaration has an
> Asis.An_Abstract_Limited_Private_Trait it's appropriate to mark it
> abstract, limited and private).

Well, actually, ASIS really has two intersecting (but not equivalent)
domains: the syntax domain and the semantic domain. ASIS rules currently
allow stuff that does not appear in the program text (like inherited
subprograms) to not show up in the ASIS queries. That's fine if you're doing
a text transformation (although ASIS annoyingly allows such stuff to appear
in ASIS queries, which can make a pure text transformation harder), but
awful if you need to dig deeper. One nasty example is that the routine that
returns the type of an object is defined to return null if the type of the
object is classwide. So how do you find out anything about that type??
Another nasty case is the aforementioned inherited subprograms -- if you
call one, you can't get the declaration of the routine that was called. But
that is often the hardest part of Ada to figure out -- I sometimes have to
read compiler symbol dumps to figure out what is going on, and it's
something that ASIS should be handling.

So the current thinking (very preliminary, I point out) is that the current
ASIS spec will be used to represent the syntactic domain, and an entirely
new set of functions and types will represent the semantic domain. (Existing
semantic queries that use the syntactic domain types in current ASIS would
be marked as obsolete and most likely not upgraded to handle new Ada 2005
concepts). This way, if you want the type of an object, you can ask for it,
and then make appropriate queries on the type object (not necessarily
associated with some source code) to find out the properties. The properties
might be traits, or simply query functions (there has been a *lot* of
discussion of this, especially as some of the traits overlap in Ada 2005
where they did not in Ada 95, thus making program breakage inevitable).
There will be ways to move back and forth between the domains: for instance,
given a type object, you can get the source code that declared it. Given a
type declaration, you can get the associated type object. Etc.

(Note: I don't see an obvious way to flatten this extra information in XML.
It's not flat in Janus/Ada; there are a number of tables that collectvely
make up the compiler symboltable, and we only flatten each one in turn. But
I'm sure you clever guys will figure out a way.)

> I see that this isn't always quite obvious: I have
>
>     type Request is limited private;
>
> giving
>
>     <private_type_declaration limited="true" private="true">
>       <defining_identifier>Request</defining_identifier>
>       <private_type_definition limited="true" private="true">
>       </private_type_definition>
>     </private_type_declaration>
>
> which seems odd (I guess that the definition is of the anonymous type
> of which the declaration is the first named subtype?)

Anonymous types shouldn't appear in the syntactic domain, but ASIS 99 does
give that sort of flexibility to implementers. Not clear what the final
decision will be on that (especially at this early stage). I'd like the
syntax domain to only provide stuff that is actually in the source code; the
meaning of the program is in the semantic domain and would be covered by new
functions. That makes nothing much optional, and ASIS programs should be
easier to write.

The problem here really is that ASIS 99 is really only the syntactic domain.
 So if you have:

     type Foo is new Bar;

this type will *not* have the limited trait, even if Foo is a limited type.
ASIS 99 is generally talking about what appears in the source code only
(although there are exceptions). So if you want to know if Foo is limited,
you have to look at the declaration of Bar. That gets complex, and it's
silly since ASIS is supposed to be making what the compiler knows
accessible, and surely the compiler knows whether Foo is limited!

> > Moreover, virtually everything in ASIS is currently optional, which
> > makes writing ASIS programs that are portable very difficult. Plus,
> > the standard itself is poorly written, and it's organization is such
> > that it is arguable that ASIS users (not to mention implementers)
> > need a license from ISO. So we're going to be busy redoing the
> > entire standard.
>
> This sounds like good news.

I think so, too. It turns out that most of the ARG had never read the ASIS
standard in detail, and when they did, they were surprised to find that it
really didn't do what it set out to do: provide a window into the compiler's
information. Either it requires creating stuff that the compiler doesn't
have or need, or it doesn't provide a way to get to the information in a
sane way at all. Hopefully we can clear this up without starting over (which
is clearly not acceptable).

                         Randy.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-09-08  2:40           ` Randy Brukardt
@ 2006-09-08 13:40             ` Georg Bauhaus
  2006-09-09  8:28               ` Manuel Collado
  0 siblings, 1 reply; 18+ messages in thread
From: Georg Bauhaus @ 2006-09-08 13:40 UTC (permalink / raw)


Randy Brukardt wrote:

> (Note: I don't see an obvious way to flatten this extra information in XML.
> It's not flat in Janus/Ada; there are a number of tables that collectvely
> make up the compiler symboltable, and we only flatten each one in turn. But
> I'm sure you clever guys will figure out a way.)

XML is anything but flat. :-) Every document instance is a tree plus
pointers, unique references, typed pointers, multipointers, index keys,
etc.
I believe you can even have nested scopes for identifiers when
using Relax NG.


-- Georg
not the clever guy, though



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-09-08 13:40             ` Georg Bauhaus
@ 2006-09-09  8:28               ` Manuel Collado
  2006-09-09 12:21                 ` Simon Wright
  2006-09-09 18:56                 ` Marc A. Criley
  0 siblings, 2 replies; 18+ messages in thread
From: Manuel Collado @ 2006-09-09  8:28 UTC (permalink / raw)


Georg Bauhaus escribió:
> Randy Brukardt wrote:
> 
>> (Note: I don't see an obvious way to flatten this extra information in XML.
>> It's not flat in Janus/Ada; there are a number of tables that collectvely
>> make up the compiler symboltable, and we only flatten each one in turn. But
>> I'm sure you clever guys will figure out a way.)
> 
> XML is anything but flat. :-) Every document instance is a tree plus
> pointers, unique references, typed pointers, multipointers, index keys,
> etc.
> I believe you can even have nested scopes for identifiers when
> using Relax NG.

What puzzles me is that the XML structure (nesting) doesn't follows the 
lexical Ada source structure. Example from avatox.adb --> avatox.adb.xml:

<A_CLAUSE ... startLine="29" endLine="29" startCol="1" endCol="29">
   <A_WITH_CLAUSE ... startLine="29" endLine="29" startCol="1" endCol="29"/>
   <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" endCol="28">
     <A_SELECTED_COMPONENT ... startLine="29" endLine="29" startCol="6" 
endCol="28"/>
     <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" endCol="19">
       ....

You can see that <A_WITH_CLAUSE> from (29,1) to (29,29) lexically contains 
<AN_EXPRESSION> from (29,6) to (29,28). But the latest is not nested inside 
the former. Instead, it appears as a sibling of it.

The same for <A_SELECTED_COMPONENT> from (29,6) to (29,28) and 
<AN_EXPRESSION> from (29,6) to (29,19).

Is that the intended behaviour?

--
Manuel Collado



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-09-09  8:28               ` Manuel Collado
@ 2006-09-09 12:21                 ` Simon Wright
  2006-09-11  7:58                   ` Manuel Collado
  2006-09-09 18:56                 ` Marc A. Criley
  1 sibling, 1 reply; 18+ messages in thread
From: Simon Wright @ 2006-09-09 12:21 UTC (permalink / raw)


Manuel Collado <m.collado@fi.upm.es> writes:

> What puzzles me is that the XML structure (nesting) doesn't follows
> the lexical Ada source structure. Example from avatox.adb -->
> avatox.adb.xml:
>
> <A_CLAUSE ... startLine="29" endLine="29" startCol="1" endCol="29">
>   <A_WITH_CLAUSE ... startLine="29" endLine="29" startCol="1" endCol="29"/>
>   <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" endCol="28">
>     <A_SELECTED_COMPONENT ... startLine="29" endLine="29" startCol="6"
> endCol="28"/>
>     <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" endCol="19">
>       ....
>
> You can see that <A_WITH_CLAUSE> from (29,1) to (29,29) lexically
> contains <AN_EXPRESSION> from (29,6) to (29,28). But the latest is not
> nested inside the former. Instead, it appears as a sibling of it.

Marc and I disagree on this one. My approach in asis2xml is to have

    <context_clauses>
      <with_clause>
        <selected_component>
          <selected_component>
            <identifier>Ada</identifier>
            <identifier>Characters</identifier>
          </selected_component>
          <identifier>Handling</identifier>
        </selected_component>
      </with_clause>

but it would be just as sensible to have

    <clause kind="with_clause">

The XPATH expressions aren't that different:

   A_CLAUSE[A_WITH_CLAUSE]
   with_clause
   clause[@kind='with_clause']

It depends what would be most useful. As an example of where user
input would be good, what about that <selected_component> structure,
which does follow the lexical structure of the language, but imagine
the query to find all withs of Ada.Characters.Handling!



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-09-09  8:28               ` Manuel Collado
  2006-09-09 12:21                 ` Simon Wright
@ 2006-09-09 18:56                 ` Marc A. Criley
  2006-09-11  8:10                   ` Manuel Collado
  1 sibling, 1 reply; 18+ messages in thread
From: Marc A. Criley @ 2006-09-09 18:56 UTC (permalink / raw)


Manuel Collado wrote:

 > What puzzles me is that the XML structure (nesting) doesn't follows the 
lexical Ada source structure. Example from avatox.adb --> avatox.adb.xml:
 >
 > <A_CLAUSE ... startLine="29" endLine="29" startCol="1" endCol="29">
 >   <A_WITH_CLAUSE ... startLine="29" endLine="29" startCol="1" endCol="29"/>
 >   <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" endCol="28">
 >     <A_SELECTED_COMPONENT ... startLine="29" endLine="29" startCol="6" 
endCol="28"/>
 >     <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" endCol="19">
 >       ....
 >
 > You can see that <A_WITH_CLAUSE> from (29,1) to (29,29) lexically 
contains <AN_EXPRESSION> from (29,6) to (29,28). But the latest is not 
nested inside the former. Instead, it appears as a sibling of it.
 >
 > The same for <A_SELECTED_COMPONENT> from (29,6) to (29,28) and 
<AN_EXPRESSION> from (29,6) to (29,19).
 >
 > Is that the intended behaviour?


Blame it on the Display_Source program which served as the progenitor of 
Avatox :-)  Here's what Display_Source generates for the corresponding 
portion that you reference:

A_CLAUSE
   A_WITH_CLAUSE
->AN_EXPRESSION
->  A_SELECTED_COMPONENT
--->AN_EXPRESSION

Avatox really did little more to the output than wrap it with an XML 
syntax.  It then added value by providing the position info and some basic 
"meta-information", i.e, the "pedigree" of an XML element, for the aid of 
post-processors.

My interest is what can happen when starting with the XML and processing 
it, rather than trying to find the bestest XML representation of an Ada 
program.  So I did minimal processing to get the XML, even if it means 
there's redundant stuff in it.  So long as its consistent, well-ordered, 
and complete (meaning all the clauses, comments, and position info), I'm happy.

-- Marc A. Criley
-- Mckae Technologies
-- www.mckae.com
-- DTraq - Avatox - XIA - XML EZ Out





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-09-09 12:21                 ` Simon Wright
@ 2006-09-11  7:58                   ` Manuel Collado
  0 siblings, 0 replies; 18+ messages in thread
From: Manuel Collado @ 2006-09-11  7:58 UTC (permalink / raw)


Simon Wright escribi�:
> Manuel Collado <m.collado@fi.upm.es> writes:
> 
>> What puzzles me is that the XML structure (nesting) doesn't follows
>> the lexical Ada source structure. Example from avatox.adb -->
>> avatox.adb.xml:
>>
>> <A_CLAUSE ... startLine="29" endLine="29" startCol="1" endCol="29">
>>   <A_WITH_CLAUSE ... startLine="29" endLine="29" startCol="1" endCol="29"/>
>>   <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" endCol="28">
>>     <A_SELECTED_COMPONENT ... startLine="29" endLine="29" startCol="6"
>> endCol="28"/>
>>     <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" endCol="19">
>>       ....
>>
>> You can see that <A_WITH_CLAUSE> from (29,1) to (29,29) lexically
>> contains <AN_EXPRESSION> from (29,6) to (29,28). But the latest is not
>> nested inside the former. Instead, it appears as a sibling of it.
> 
> Marc and I disagree on this one. My approach in asis2xml is to have
> 
>     <context_clauses>
>       <with_clause>
>         <selected_component>
>           <selected_component>
>             <identifier>Ada</identifier>
>             <identifier>Characters</identifier>
>           </selected_component>
>           <identifier>Handling</identifier>
>         </selected_component>
>       </with_clause>
> 
> but it would be just as sensible to have
> 
>     <clause kind="with_clause">
> 
> The XPATH expressions aren't that different:
> 
>    A_CLAUSE[A_WITH_CLAUSE]
>    with_clause
>    clause[@kind='with_clause']
> 
> It depends what would be most useful. As an example of where user
> input would be good, what about that <selected_component> structure,
> which does follow the lexical structure of the language, but imagine
> the query to find all withs of Ada.Characters.Handling!

Well, the // (descendant) axis of XPATH looks directly for inner nodes, 
skipping intermediate levels.

-- 
Manuel Collado



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: ANNOUNCE: Avatox 1.0 is now available
  2006-09-09 18:56                 ` Marc A. Criley
@ 2006-09-11  8:10                   ` Manuel Collado
  0 siblings, 0 replies; 18+ messages in thread
From: Manuel Collado @ 2006-09-11  8:10 UTC (permalink / raw)


Marc A. Criley escribi�:
> Manuel Collado wrote:
> 
>  > What puzzles me is that the XML structure (nesting) doesn't follows 
> the lexical Ada source structure. Example from avatox.adb --> 
> avatox.adb.xml:
>  >
>  > <A_CLAUSE ... startLine="29" endLine="29" startCol="1" endCol="29">
>  >   <A_WITH_CLAUSE ... startLine="29" endLine="29" startCol="1" 
> endCol="29"/>
>  >   <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" 
> endCol="28">
>  >     <A_SELECTED_COMPONENT ... startLine="29" endLine="29" 
> startCol="6" endCol="28"/>
>  >     <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" 
> endCol="19">
>  >       ....
>  >
>  > You can see that <A_WITH_CLAUSE> from (29,1) to (29,29) lexically 
> contains <AN_EXPRESSION> from (29,6) to (29,28). But the latest is not 
> nested inside the former. Instead, it appears as a sibling of it.
>  >
>  > The same for <A_SELECTED_COMPONENT> from (29,6) to (29,28) and 
> <AN_EXPRESSION> from (29,6) to (29,19).
>  >
>  > Is that the intended behaviour?
> 
> 
> Blame it on the Display_Source program which served as the progenitor of 
> Avatox :-)  

I'm not blaming anything. On the contrary, I'm warmly grateful of people 
that write useful utilities, like asis2xml or avatox, and make them 
publicly available!

> Here's what Display_Source generates for the corresponding 
> portion that you reference:
> 
> A_CLAUSE
>   A_WITH_CLAUSE
> ->AN_EXPRESSION
> ->  A_SELECTED_COMPONENT
> --->AN_EXPRESSION
> 
> Avatox really did little more to the output than wrap it with an XML 
> syntax.  It then added value by providing the position info and some 
> basic "meta-information", i.e, the "pedigree" of an XML element, for the 
> aid of post-processors.
> 
> My interest is what can happen when starting with the XML and processing 
> it, rather than trying to find the bestest XML representation of an Ada 
> program.  So I did minimal processing to get the XML, even if it means 
> there's redundant stuff in it.  So long as its consistent, well-ordered, 
> and complete (meaning all the clauses, comments, and position info), I'm 
> happy.

Well, I've quicky written my own utility (an xmlgawk script) to reorder the 
elements so the XML nesting does follow the lexical nesting. The following 
fragment from avatox.adb.xml:

<A_CLAUSE pedigree="asis" startLine="29" endLine="29" startCol="1" endCol="29">
    <A_WITH_CLAUSE pedigree="asis" startLine="29" endLine="29" startCol="1" 
endCol="29"/>
    <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" startCol="6" 
endCol="28">
       <A_SELECTED_COMPONENT pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="28"/>
       <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="19">
          <A_SELECTED_COMPONENT pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="19"/>
          <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="8">
             <AN_IDENTIFIER pedigree="asis" ident="Ada" startLine="29" 
endLine="29" startCol="6" endCol="8"/>
          </AN_EXPRESSION>
          <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="10" endCol="19">
             <AN_IDENTIFIER pedigree="asis" ident="Characters" 
startLine="29" endLine="29" startCol="10" endCol="19"/>
          </AN_EXPRESSION>
       </AN_EXPRESSION>
       <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="21" endCol="28">
          <AN_IDENTIFIER pedigree="asis" ident="Handling" startLine="29" 
endLine="29" startCol="21" endCol="28"/>
       </AN_EXPRESSION>
    </AN_EXPRESSION>
</A_CLAUSE>


becomes


<A_CLAUSE pedigree="asis" startLine="29" endLine="29" startCol="1" endCol="29">
     <A_WITH_CLAUSE pedigree="asis" startLine="29" endLine="29" 
startCol="1" endCol="29">
         <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="28">
             <A_SELECTED_COMPONENT pedigree="asis" startLine="29" 
endLine="29" startCol="6" endCol="28">
                 <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="19">
                     <A_SELECTED_COMPONENT pedigree="asis" startLine="29" 
endLine="29" startCol="6" endCol="19">
                         <AN_EXPRESSION pedigree="asis" startLine="29" 
endLine="29" startCol="6" endCol="8">
                             <AN_IDENTIFIER pedigree="asis" ident="Ada" 
startLine="29" endLine="29" startCol="6" endCol="8">
                             </AN_IDENTIFIER>
                         </AN_EXPRESSION>
                         <AN_EXPRESSION pedigree="asis" startLine="29" 
endLine="29" startCol="10" endCol="19">
                             <AN_IDENTIFIER pedigree="asis" 
ident="Characters" startLine="29" endLine="29" startCol="10" endCol="19">
                             </AN_IDENTIFIER>
                         </AN_EXPRESSION>
                     </A_SELECTED_COMPONENT>
                 </AN_EXPRESSION>
                 <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="21" endCol="28">
                     <AN_IDENTIFIER pedigree="asis" ident="Handling" 
startLine="29" endLine="29" startCol="21" endCol="28">
                     </AN_IDENTIFIER>
                 </AN_EXPRESSION>
             </A_SELECTED_COMPONENT>
         </AN_EXPRESSION>
     </A_WITH_CLAUSE>
</A_CLAUSE>


> 
> -- Marc A. Criley
> -- Mckae Technologies
> -- www.mckae.com
> -- DTraq - Avatox - XIA - XML EZ Out

-- 
Manuel Collado




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2006-09-11  8:10 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-17  0:58 ANNOUNCE: Avatox 1.0 is now available Marc A. Criley
2006-08-17  2:10 ` Jeffrey Creem
2006-08-18  8:03 ` Pascal Obry
2006-08-18  8:04 ` Pascal Obry
2006-08-18  8:05 ` Pascal Obry
2006-08-21 20:59 ` Simon Wright
2006-08-24  0:41   ` Marc A. Criley
2006-08-24  6:03     ` Simon Wright
2006-08-25  1:15       ` Marc A. Criley
2006-09-06 23:29       ` Randy Brukardt
2006-09-07 20:46         ` Simon Wright
2006-09-08  2:40           ` Randy Brukardt
2006-09-08 13:40             ` Georg Bauhaus
2006-09-09  8:28               ` Manuel Collado
2006-09-09 12:21                 ` Simon Wright
2006-09-11  7:58                   ` Manuel Collado
2006-09-09 18:56                 ` Marc A. Criley
2006-09-11  8:10                   ` Manuel Collado

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