Can someone please tell me a good reason why my requests
here are being ignored?
Clifford Heath.
On 14/10/2010, at 10:05 PM, Clifford Heath wrote:
Bump. Another way to say what I'd like to be able to do.
I'd like to expose an interface that allows me to get the AST (as
JS objects) from the internal parser, and I'd like to be able to write
JS that creates an AST, and executes it by passing it to the existing
JIT code generators.
What needs to be done for that to be possible?
I'm happy if these AST objects are "special" in whatever way
necessary. For example, the internal parser allocates AST nodes
from the Zone - that would be fine, these don't need to be GC'd.
They can be subject to custom wholesale de-allocation instead,
if that makes sense.
This would make possible a wide variety of awesome language
experiments within the V8 ecosystem.
Clifford Heath.
On 08/10/2010, at 12:11 PM, Clifford Heath wrote:
Hello all. I have been browsing the V8 source to see if I can find
a way to use it as a basis for a language experiment. I won't
describe the whole experiment here, just the features I will need.
Basically, I want to use the V8 engine to run multiple languages,
and to support extensible grammars for each language. I don't
want to preprocess these languages into JS and run that, rather
I want my grammars to directly yield V8 ASTs that work with the
JIT code generators.
Each grammar has a "top" rule but can be entered from many
lower rules too, and one grammar can invoke another grammar
at any point, using a call like:
ast = grammar1.parse(source_code, start_rule_name)
(where start_rule_name defaults to the top rule). This type of call
works because the grammar is a PEG, hence is composable
without prior analysis.
To kick it off, I'd like to adapt an existing JS PEG grammar and
have it return the internal AST structures (which aren't JS objects,
obviously). These come from Zone memory; possibly the PEG
rules would just yield some kind of pointer object to the real AST
node. I'm happy to allow the restriction that these AST references
not be saved anywhere. But this means that initially there would
be two JS parsers, one native and one written in JS.
So the gist of my question is this: what's the best way to go about
providing direct access to building, returning and running ASTs at
the JS level?
Clifford Heath.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev