AST in JSON format

Kevin Curtis kevinc1846 at googlemail.com
Mon Oct 19 10:03:35 PDT 2009


A patch is available for the V8 engine which enables:

JSON.AST.parse(|js source code|) -> |AST JsonML String|

At:
http://code.google.com/p/ecmascript-ast/


On Sat, Oct 17, 2009 at 2:47 PM, Kevin Curtis <kevinc1846 at googlemail.com> wrote:
> DSH - very interesting.
>
> Is the idea eventually (for say ES6) to have something like like the
> Python ast module, where the AST (in JsonML format) can be executed?
> Or just js source to source roundtripping. e.g js -> JsonML AST -> js
>
> I'm working on an experiment utilizing the V8 engine - using the JSON
> object as a (temporary) namespace:
>
> var source = "var x = 3; if (x > 2) print('hello world');";
>
> var astStr = JSON.AST.parse(source); // returns the AST in a JsonML string
>
> JSON.AST.execute(astStr);
>
>> hello world
>


More information about the es-discuss mailing list