AST in JSON format

David-Sarah Hopwood david-sarah at
Tue Dec 8 02:18:39 PST 2009

Oliver Hunt wrote:
> <snip>
>> OTOH, if we standardize an AST format, then presumably we'll be adding
>> a source->AST API function that uses the implementation's existing parser.
> I'd be worried about assuming that this is an obvious/trivial thing for
> implementations to do, you're effectively requiring that the internal AST
> representation of an implementation be entirely standardised.

Not at all. An implementation could, for example, parse to its internal
AST format and then convert from that to the standard format (which is a
trivial tree walk). This only requires that the internal format not lose
information relative to the standard one. If it does currently lose
information, then changing it not to is relatively straightforward.

In any case, without a source->AST API, what use is a standard AST format?
The existance of that API (and the corresponding AST->source pretty-printing
API) is the main motivation for standardizing the format, AFAICS.

David-Sarah Hopwood  ⚥

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 292 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the es-discuss mailing list