babel / proposals

✍️ Tracking the status of Babel's implementation of TC39 proposals (may be out of date)
https://github.com/tc39/proposals
433 stars 39 forks source link

Binary AST (Stage 1) #21

Open hzoo opened 7 years ago

hzoo commented 7 years ago

Champions: @syg, @vdjeric, @Yoric, @kannan-vijayan Spec Repo: https://github.com/syg/ecmascript-binary-ast/ First presented at the July 2017 meeting: https://github.com/tc39/agendas/blob/master/2017/07.md

Why is this relevant

Babel operates on an AST, and would be part of the toolchain that should be able to take advantage of this format. This would help consolidate tooling to use the same AST. Would be a breaking change, unless our AST is adopted (unlikely, and probably not desired).

littledan commented 7 years ago

At this point, there's no particular implementation action to be taken. The binary format has not yet been fully designed.

Jamesernator commented 6 years ago

There's now an official early spec, it'd be cool if the parts of Babel could (optionally) use this format in future instead of the ESTree based one.

I'll give a shot at creating a tool that converts Babylon's (estree-like) ASTs into the format currently in the spec to see how difficult this might be.

syg commented 6 years ago

I am very happy by the reception but I think it’s still too early. There’s a lot of the corners of the spec that are just missing. I’ll make an effort to fill out the spec before the July meeting.

On May 25, 2018, at 07:48, James Browning notifications@github.com wrote:

There's now an official early spec, it'd be cool if the parts of Babel could (optionally) use this format in future instead of the ESTree based one.

I'll give a shot at creating a tool that converts Babylon's (estree-like) ASTs into the format currently in the spec to see how difficult this might be.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Jamesernator commented 6 years ago

I don't really intend to publish anything per se other than maybe sharing a link to an interactive version until the spec is more stable. But I think trying to implement a Babel -> BinaryAST converter will give some good insights.

I've already found a couple of odd bits and pieces in the AST that I (personally) find odd so I'll open some issues on the binary AST repo itself.

bakkot commented 6 years ago

@Jamesernator, you might want to take a look at https://github.com/shapesecurity/shift-spidermonkey-converter-js, which does conversions between a format similar to the one in binast (i.e. shift) and a format similar to the one in babel (i.e. estree). It's a little out of date, but not too far off.

syg commented 6 years ago

Excellent, please file issues on the spec repo.

On May 25, 2018, at 11:23, James Browning notifications@github.com wrote:

I don't really intend to publish anything per se other than maybe sharing a link to an interactive version until the spec is more stable. But I think trying to implement a Babel -> BinaryAST converter will give some good insights.

I've already found a couple of odd bits and pieces in the AST that I (personally) find odd so I'll open some issues on the binary AST repo itself.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

bakkot commented 6 years ago

@Jamesernator, did you ever end up filing those issues? If you (remember them) and still think they're valid, I'd be interest in reading them.

mgttt commented 5 years ago

Dear all, is there any "compressed" AST algorithm available? My scenario is to ship sort-of compile code snapshot to live server, which trigger by github-hook (i.e. after source code pushed to github, using a hook to forward the code and compile and then ship to live server)....

Yoric commented 5 years ago

@wanjochan The latest versions of the Binary AST format use a compressed format, yes. It's still very experimental, though, and the details of the format will change.