Re: How to store an AST

"Dave Hanson" <>
7 May 1999 21:10:47 -0400

          From comp.compilers

Related articles
How to store an AST (Salvador V. Cavadini) (1999-04-30)
Re: How to store an AST (Steve Mading) (1999-05-07)
Re: How to store an AST (Dave Hanson) (1999-05-07)
Re: How to store an AST (Mike Harrison) (1999-05-09)
Re: How to store an AST (Nils M Holm) (1999-05-16)
Re: How to store an AST (Willy Jacobs) (1999-05-16)
| List of all articles for this month |

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

Salvador V. Cavadini <> 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

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 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.