comp.lang.ada
 help / color / mirror / Atom feed
From: Tero Koskinen <tero.koskinen@iki.fi>
Subject: Data structures for syntax trees
Date: Mon, 1 Feb 2010 21:34:41 +0200
Date: 2010-02-01T21:34:41+02:00	[thread overview]
Message-ID: <20100201213441.503839d5.tero.koskinen@iki.fi> (raw)

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



             reply	other threads:[~2010-02-01 19:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01 19:34 Tero Koskinen [this message]
2010-02-01 20:03 ` Data structures for syntax trees Dmitry A. Kazakov
replies disabled

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