I was planning to spend at least a few hours on translating JavaScript object notation to emit a Map instead. Turns out it took me about 5 minutes, thanks to the way the example JavaScript parser works!
var id = "name";
var data = {
id: "abc", 1: "one"
};
console.log(data);
This is is so simple to translate since the parser doesn't discriminate object key types. They can be strings, identifiers, numbers... not valid JavaScript, but who's to decide? The parser or the emitter? In my case it worked for my benefit. The above outputs:
Map { 'name' => 'abc', 1 => 'one' }
Nice. And the emitter is only 10 lines of code -- I didn't even touch the parser. PEG.js is making it so easy to work on my project.
Mike