Re: ANN: Ada source code decorator



Simon Wright <simon@xxxxxxxxxxxx> writes:

Stephen Leake <stephen_leake@xxxxxxx> writes:

Simon Wright <simon@xxxxxxxxxxxx> writes:

Stephen Leake <stephen_leake@xxxxxxx> writes:

You are arguing that the particular structure defined in the ASIS spec
is not one you would use for your particular application.

That is certainly your choice. Everyone else will also have a
particular choice; probably different. I suspect the choice of
structure depends heavily on the algorithm you want to implement.

It would be completely unnatural in XML to represent the concept of a
name with components as a nested structure. For a start, the XPath
expressions involved will be unmanageable.

Hmm. Taken purely at face value, that tells me that XML is not a
suitable representation for Ada :).

But if there are a few standard transformations from the ASIS
structure to the XML structure, that would be ok.

For info, the output from

generic
package Basis is
type Base is abstract tagged private;
procedure Op (B : Base) is abstract;
private
type Base is abstract tagged record
V : Boolean;
end record;
end Basis;

was

<asis>
<generic_package_declaration>
<defining_identifier>Basis</defining_identifier>
<private_type_declaration kind="abstract_private_trait">
<defining_identifier>Base</defining_identifier>
<tagged_private_type_definition kind="abstract_private_trait">
</tagged_private_type_definition>
</private_type_declaration>
<procedure_declaration kind="abstract_trait">
<defining_identifier>Op</defining_identifier>
<parameter_specification kind="ordinary_trait"
mode="default_in_mode">
<defining_identifier>B</defining_identifier>
<identifier>Base</identifier>
</parameter_specification>
</procedure_declaration>
<ordinary_type_declaration>
<defining_identifier>Base</defining_identifier>
<type_definition>
<tagged_record_type_definition kind="abstract_trait">
</tagged_record_type_definition>
<record_definition>
<component_declaration>
<defining_identifier>V</defining_identifier>
<component_definition kind="ordinary_trait" size="8">
<subtype_indication>
<identifier>Boolean</identifier>
</subtype_indication>
</component_definition>
</component_declaration>
</record_definition>
</type_definition>
</ordinary_type_declaration>
</generic_package_declaration>
</asis>

which probably makes more sense to you than to me.

There seems to be a lot missing. Remember that I have never used XML
in an application, but my impression was that it's supposed to be a
self-documenting format. So, for example, I would expect the various
identifiers to be labeled more specifically; "variable_identifier",
"type_identifier". Or have names that match the ASIS query that
returned them.

I guess if there was an XML grammar to go along with this, that would
specify that information.

I can get some of it, of course, but -- for example -- what other
sorts of traits are there and what do they actually mean?

That does require a better ASIS manual.

This looks like a good start on an XML tool for Ada; I'll keep it in
mind if I ever start using XML :).

--
-- Stephe
.



Relevant Pages

  • ANN: ASIS2XML 20041024a
    ... ASIS2XML converts a unit's ASIS representation into XML, ... it relies on GNAT; ... Not every ASIS feature is supported yet. ...
    (comp.lang.ada)
  • ANNOUNCE: Avatox 1.0 is now available
    ... 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. ...
    (comp.lang.ada)
  • Re: ANN: Ada source code decorator
    ... compiler has to provide functions to access that knowledge. ... The point of ASIS is to provide a standard way to access information ... version of ASIS will specify the format, using XML. ...
    (comp.lang.ada)
  • ANNOUNCE: Avatox 1.2 Now Available
    ... Avatox (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. ...
    (comp.lang.ada)