Re: How to store an AST

"Dave Hanson" <drh@microsoft.com>
7 May 1999 21:10:47 -0400

          From comp.compilers

Related articles
How to store an AST salvador@ucseii.edu.ar (Salvador V. Cavadini) (1999-04-30)
Re: How to store an AST madings@baladi.nmrfam.wisc.edu (Steve Mading) (1999-05-07)
Re: How to store an AST drh@microsoft.com (Dave Hanson) (1999-05-07)
Re: How to store an AST mph@zdenka.demon.co.uk (Mike Harrison) (1999-05-09)
Re: How to store an AST nmh@dialup.nacamar.de (Nils M Holm) (1999-05-16)
Re: How to store an AST WN.Jacobs@net.HCC.nl (Willy Jacobs) (1999-05-16)
| List of all articles for this month |

From: "Dave Hanson" <drh@microsoft.com>
Newsgroups: comp.compilers
Date: 7 May 1999 21:10:47 -0400
Organization: Microsoft Corp.
References: 99-04-120
Keywords: design

Salvador V. Cavadini <salvador@ucseii.edu.ar> wrote
> I'm programming a front-end for a tool and I need to store in disk the
> AST produced by the parser. The rest of the tool will randomly access
> the AST's nodes. I would be greatful if someone can recommend an
> efficient way for store the AST.


This problem is exactly what ASDL (Abstract Syntax Description
Language) and its tools solve. Here's a 1-paragraph description of
ASDL from my paper "Early Experience with ASDL in lcc",
Software-Practice and Experience 29 (5), 417-435, 4/99
(http://www.research.microsoft.com/~drh/pubs/asdl.pdf)


ASDL is a small, domain-specific language for describing tree data
structures. ASDL specifications are concise and independent of any
particular programming language. The ASDL generator, asdlGen, accepts
an ASDL specification and emits code that defines a concrete
representation for the data structures described in the specification,
along with code that constructs, reads, and writes instances of those
data structures. Currently, asdlGen can emit data-structure
implementations in C, C++, Java, ML, and Haskell. ASDL specifications
tend to be much smaller than the corresponding language-specific
data-structure and function definitions.


See http://www.cs.princeton.edu/zephyr/ASDL/ for more information and
the software itself.


dave hanson


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.