[swift-dev] Consider removing the space in Swift AST dump's "decl" attribute?

Dmitri Gribenko gribozavr at gmail.com
Mon May 9 12:37:41 CDT 2016


On Mon, May 9, 2016 at 10:00 AM, Minsheng Liu <lambda at liu.ms> wrote:
> Thanks for your information. However, what I intend to work on is a
> Swift-to-JS translator, which I guess probably need to stick with the
> upstream anyway. I think that make the output a bit more parsing-friendly
> will not harm, will it?

It will.  Even if the format was parsing-friendly, it wouldn't be a
stable format.  Making it parsing-friendly would be sort of making a
promise that we can't keep.

> Moreover, if you do not suggest parse the dumped AST, is there any
> recommended way to reuse the compiler’s front-end?

Using compiler APIs directly as Joe said is the best way.  There are a
lot of AST details that are not represented in the textual dump.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/


More information about the swift-dev mailing list