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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!colt.net!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!bnewspeer01.bru.ops.eu.uu.net!emea.uu.net!fi.sn.net!newsfeed2.tdcnet.fi!news.song.fi!not-for-mail Date: Mon, 1 Feb 2010 21:34:41 +0200 From: Tero Koskinen Newsgroups: comp.lang.ada Subject: Data structures for syntax trees Message-ID: <20100201213441.503839d5.tero.koskinen@iki.fi> X-Newsreader: Sylpheed 2.7.1 (GTK+ 2.18.6; i686-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Organization: NBL Networks Oy NNTP-Posting-Host: 217.30.184.161 X-Trace: 1265052882 news.nbl.fi 6251 217.30.184.161:30039 X-Complaints-To: abuse@nblnetworks.fi Xref: g2news1.google.com comp.lang.ada:8846 Date: 2010-02-01T21:34:41+02:00 List-Id: Hi, I am looking for advice on what kind of data structures to use for abstract syntax trees. At the moment, I want present JSON language as a tree: http://www.json.org/ The requirement is that the data structure works with GNAT GPL and Janus/Ada. So far, the Janus/Ada part has been giving me trouble. (With GNAT everything works.) I have tried to avoid access types and create a tree structure using tagged types. However, Janus/Ada has some bugs with either with class-wide types or parameterized types containing controlled types and passing/copying them around causes crashes when the produced executable is run. RR Software is aware of the issue, but hasn't been able to give estimate when the issue will be fixed. So, I am looking for alternatives. My current (crashing[1]) attempt is available at http://bitbucket.org/tkoskine/jdaughter/src/950f001bf2aa/src/json-data.ads http://bitbucket.org/tkoskine/jdaughter/src/950f001bf2aa/src/json-parser.adb (Basically I have bunch of tagged types derived from JSON_Root_Type and a few container types, which take JSON_Root_Type'Class objects.) RR Software told me that using access types should work, but I would avoid that as long as possible. Is there still some nice way to avoid access types (in the public API at least) while also not using class-wide or controlled types? And what kind of data structures others have used to present syntax trees? -Tero [1] crash usually happens in line 134 or 146 of json-data.adb