Kevin, thanks for the feedback - very useful.

> It is literally the V8 AST, so there are some V8-specific things in there.
>  (We also rewrite some of the AST at parse time, so it doesn't allow
> roundtripping back to the original parsed JS.)

In the code review you mentioned that this functionality "is motivated
by a desire to prototype source-to-source transformations in
JavaScript itself (or anything else that can grok JSON), but it should
have other uses too."

That would be very useful re templating/macros/type checking etc.
Precise roundtripping is not important. Is there any JS code which can
read the jsonML and produce JS source?

> > - allowing parsing/evaluation from within the engine
>
> That's not an intended use.

But could be useful :). Hmmh - but where to put it namespace-wise.
Maybe an AST module in ESHarmony.


A bit OT - my interest is for a project called zedscript aka Zed is
Ecmascript for Dummies:
http://code.google.com/p/zedscript/

It's goal is to provide an alternative pseudocode-ish syntax sugar
over the core ecmascript semantics - to show the 'best face' of ES/ES5/
Harmony re simplicity, security, speed and expressiveness; and
minimize quirks, gotchas and cruft. It's not a port of ruby, python
etc - sticks closely to the underlying ecmascript semantics.

It does this by targetting the V8 AST directly - rather than zedscript
source -> JS source. The zedscript prototype on googlecode is
currently a hack of the V8 parsing and scanning C++ so that V8 shell
can process both JS and zedscript syntax to build the native AST. If
AST.parse(|JS string|) and AST.evaluate(|jsonML string|) (or
parseAstToJS(|jsonML string)) were available - the scanning/parsing
could be written in JS - rather like natives.js etc. Which would be a
cool alternative. Even so, the implementation/development cost in C++
was small - as so much code was reused.

Looks like the proverbial 'easy win' for a forward looking
organization. cough. Many users will never get on with the curly C
syntax. A simple, safe and expressive alternative syntax which runs in
the browser - and on the client/server - would be a big benefit for a
lot of users. Given that crufty features could be hidden maybe there
would be opportunities to take advantage of the V8 engine re
performance.

Regards.
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to