The idea of prototyping a 'standard' AST format in JSON was discussed
at es-discuss:
https://mail.mozilla.org/pipermail/es-discuss/2009-May/009231.html
And jsonML was suggested. A sample:
["||",
["||",
["Id", "X"],
["Id", "Y"]],
["Id", "Z"]]
I was about to start hacking V8 to develop a prototype of allowing the
V8 AST to be serialized/output in jsonML.
But it looks like a Google engineer has developed a patch. Excellent!
http://codereview.chromium.org/131101
Which enables:
shell_g --print_json_ast myfile.js
The goal of the prototype is to enable:
- the parsing of ecmascript source to a serialized AST in jsonML
(covered by the above patch)
- the evaluation/execution of the jsonML
I was thinking of experimentally using the global JSON object as a
namespace:
JSON.AST.parse(|string of ecmascript source|) -> |string of jsonML|
JSON.AST.evaluate(|string of jsonML|) -> undefined or a js value.
Do the V8 team have any ideas re:
- is the jsonML format V8 AST specific or can it be generic
- allowing parsing/evaluation from within the engine
- is the patch going to be applied to the trunk.
Regards.
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---