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

Reply via email to