{"id":13411402,"url":"https://github.com/simonjwright/asis2xml","last_synced_at":"2025-03-14T17:30:48.118Z","repository":{"id":135312134,"uuid":"183614719","full_name":"simonjwright/asis2xml","owner":"simonjwright","description":"Converts Ada sources’ ASIS representation to XML,  so as to make it easier to develop reporting and transformational tools using (for example) XSLT.","archived":false,"fork":false,"pushed_at":"2019-05-01T15:03:06.000Z","size":71,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-10T16:55:22.524Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ada","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonjwright.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-04-26T11:12:32.000Z","updated_at":"2021-12-12T19:09:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"c431fa64-2a6c-456c-8399-c6e87fb27533","html_url":"https://github.com/simonjwright/asis2xml","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonjwright%2Fasis2xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonjwright%2Fasis2xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonjwright%2Fasis2xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonjwright%2Fasis2xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonjwright","download_url":"https://codeload.github.com/simonjwright/asis2xml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243618610,"owners_count":20320266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:13.435Z","updated_at":"2025-03-14T17:30:47.876Z","avatar_url":"https://github.com/simonjwright.png","language":"Ada","funding_links":[],"categories":["Applications"],"sub_categories":["Generators and Translators"],"readme":"# ASIS2XML #\n\nASIS is the\n[Ada Semantic Interface Specification](http://www.acm.org/sigada/WG/asiswg/).\n\nThis program converts a unit's ASIS representation into XML, so as to make it easier to develop reporting and transformational tools using (for example) XSLT.\n\nNot every ASIS feature is supported, and in particular\n\n  * What you get corresponds to a straightforward navigation through the tree, there's no cross-linking.\n  * There's no attempt to relate the structure to the source text.\n  * Comments aren't preserved.\n\nThere is no XML Schema as yet. The output's structure is quite close to that of ASIS, at least in overall terms; for example, an `A_Defining_Name` element in ASIS is represented as a `\u003cdefining_name/\u003e` element in XML. This is hardly surprising since the default strategy, faced with an ASIS Element, is to translate it to an XML element with the indicated substitution!\n\nIn turn, ASIS's structure is largely that of the Ada RM.\n\n## Example ##\n\nThe source unit `demo.adb`,\n```ada\nprocedure Demo (X : in out Integer) is\nbegin\n   X := X + 1;\nend Demo;\n```\nresults, after using _tidy_, in\n```\n\u003casis\u003e\n  \u003ccompilation_unit file=\"/Users/simon/asis2xml/demo.adb\"\n  unit=\"Demo\"\u003e\n    \u003ccontext_clauses\u003e\u003c/context_clauses\u003e\n    \u003cunit_declaration\u003e\n      \u003cprocedure_body_declaration\u003e\n        \u003cdefining_identifier\u003eDemo\u003c/defining_identifier\u003e\n        \u003cparameter_specification mode=\"inout\"\u003e\n          \u003cdefining_identifier\u003eX\u003c/defining_identifier\u003e\n          \u003cidentifier\u003eInteger\u003c/identifier\u003e\n        \u003c/parameter_specification\u003e\n        \u003cassignment_statement\u003e\n          \u003cidentifier\u003eX\u003c/identifier\u003e\n          \u003cfunction_call prefixed=\"false\"\u003e\n            \u003cparameter_association\u003e\n              \u003cidentifier\u003eX\u003c/identifier\u003e\n            \u003c/parameter_association\u003e\n            \u003coperator_symbol\u003e\"+\"\u003c/operator_symbol\u003e\n            \u003cparameter_association\u003e\n              \u003cinteger_literal\u003e1\u003c/integer_literal\u003e\n            \u003c/parameter_association\u003e\n          \u003c/function_call\u003e\n        \u003c/assignment_statement\u003e\n      \u003c/procedure_body_declaration\u003e\n    \u003c/unit_declaration\u003e\n    \u003ccompilation_pragmas\u003e\u003c/compilation_pragmas\u003e\n  \u003c/compilation_unit\u003e\n\u003c/asis\u003e\n```\nThis project was originally hosted on SourceForge as part of [ASIS for GNAT](https://sourceforge.net/projects/gnat-asis/), and releases up to 20130413 can be found there.\n\nLater, it moved to [ASIS2XML](https://sourceforge.net/projects/asis2xml/), also on SourceForge, and releases up to 20190426 can be found there.\n\n## Copyright ##\n\nThis work is derived from the Node\\_Trav component of Display\\_Source, which used to be distributed as a part of the ASIS implementation for GNAT and is Copyright (c) 1995-1999, Free Software Foundation, Inc.\n\nThe original work in the program is Copyright (c) Simon Wright `\u003csimon@pushface.org\u003e`.\n\n## Licensing ##\n\nThe work is distributed under the terms of the [GPL, version 2](http://www.gnu.org/copyleft/gpl.html).\n\n## Prerequisites ##\n\n* GNAT: GPL 2012 or later, or GCC 4.8 or later\n\n* The corresponding GNAT ASIS\n\n* [XML/Ada](https://github.com/AdaCore/xmlada) 1.0 or later\n\n## Use ##\n\n`asis2xml` will accept a tree file (`.adt`), or a directory which is a GNAT object directory containing a set of `.adt` files. The GNAT ASIS implementation doesn't understand Project files, so if you have any sort of complex path setup the way to go is to generate the tree files using the Project:\n```sh\n$ gprbuild -Pbuild -c -u -f -gnatct example.ads\n```\ncreates `example.adt` in your project (`build.gpr`)'s `Object_Dir` -- in the case of `asis2xml`'s `asis2xml.gpr`, this is `./.build`.\n```sh\n$ asis2xml .build/example.adt \u003eexample.xml\n```\nThe output is in \"packed\" XML; to get a more legible view, you can\nuse [HTML Tidy](http://www.html-tidy.org):\n```sh\n$ asis2xml .build/example.adt | tidy -xml -i -utf8 \u003eexample.tidy.xml\n```\nor variations.\n\n## Differences from GNAT ASIS structure ##\n\nIf you want to perform analysis on the generated XML, the best way (absent a schema) is to write sample code and see what _asis2xml_ makes of it. That said,\n\n### Attributes ###\n\nExtensive use is made of attributes (for example, `mode=\"inout\"` above).\n\n### Visible/private parts ###\n\nFor the kinds of element that have visible/private parts (normal and generic packages, tasks and protected types) the visible and private parts are enclosed in `\u003cvisible_part/\u003e` and `\u003cprivate_part/\u003e` elements respectively.\n\n### Pragmas ###\n\nPragmas are represented more naturally:\n```xml\n\u003cpragma kind=\"storage_size\"\u003e\n  \u003cidentifier\u003eStorage_Size\u003c/identifier\u003e\n  \u003cpragma_argument_association\u003e\n    \u003cinteger_literal\u003e2048\u003c/integer_literal\u003e\n  \u003c/pragma_argument_association\u003e\n\u003c/pragma\u003e\n```\n\n### Compound identifiers ###\n\nCompound identifiers are hard to deal with: `with\nAda.Characters.Handling;` becomes, in the default ASIS structure,\n```xml\n\u003cwith_clause\u003e\n  \u003cselected_component\u003e\n    \u003cselected_component\u003e\n      \u003cidentifier\u003eAda\u003c/identifier\u003e\n      \u003cidentifier\u003eCharacters\u003c/identifier\u003e\n    \u003c/selected_component\u003e\n    \u003cidentifier\u003eHandling\u003c/identifier\u003e\n  \u003c/selected_component\u003e\n\u003c/with_clause\u003e\n```\nASIS2XML modifies this by inserting an `\u003cexpanded_name/\u003e` element:\n```xml\n\u003cwith_clause\u003e\n  \u003cexpanded_name\u003eAda.Characters.Handling\n  \u003cselected_component\u003e\n    \u003cselected_component\u003e\n      \u003cidentifier\u003eAda\u003c/identifier\u003e\n      \u003cidentifier\u003eCharacters\u003c/identifier\u003e\n    \u003c/selected_component\u003e\n    \u003cidentifier\u003eHandling\u003c/identifier\u003e\n  \u003c/selected_component\u003e\u003c/expanded_name\u003e\n\u003c/with_clause\u003e\n```\nThis is similar to the GNAT ASIS `\u003cdefining_expanded_name/\u003e`, used for\ncompound program unit names.\n\nNote that both these structures require changes to the way you would normally expect to process the XML:\n\n  * `\u003cexpanded_name/\u003e` appears in the places where, if unqualified, you'd expect to find an `\u003cidentifier/\u003e`, an `\u003coperator_symbol/\u003e`, or a `\u003ccharacter_literal/\u003e.\n\n  * `\u003cdefining_expanded_name/\u003e` appears in the places where, if unqualified, you'd expect to find a `\u003cdefining_identifier/\u003e`.\n\nIn either case, the XML contains further child elements, so you need to extract the text of just this node:\n```xsl\n\u003cxsl:value-of select=\"text()\"/\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonjwright%2Fasis2xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonjwright%2Fasis2xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonjwright%2Fasis2xml/lists"}