nodejs / llnode

An lldb plugin for Node.js and V8, which enables inspection of JavaScript states for insights into Node.js processes and their core dumps.
Other
1.15k stars 99 forks source link

Introducing bison as a dependency #341

Closed mmarchini closed 4 years ago

mmarchini commented 4 years ago

For two features I have in mind (arbitrary accessors #314 and queries for findjsinstances #334) it would be useful to have a lexer/parser integrated on llnode. One of the most popular is bison. Introducing it as a dependency without carrying that to our users can be tricky, but I think it can be done if:

1) we only require bison for development 2) when publishing, we generate .cc files from the lexical definitions and upload those to npm

Does anyone have objections on introducing bison as dependency?

joyeecheung commented 4 years ago

How powerful should the grammar of the expression we support be? If we only support the dot and bracket access operators it seems to be a somewhat overkill to introduce bison. But again if it turns out to require, say, > 200 lines to parse this then including bison sounds fine to me.

mmarchini commented 4 years ago

314 has a draft parser for .attribute and [0-9], it doesn't take into account things like ["foo bar"]. I'm also sure it has bugs, because I implemented it as a proof-of-concept only.

For findjsinstances queries, we could have a complex grammar with !, &&, ||, ==, !=, etc., in which case the parser would probably be over 200 lines. Not sure if we want something so complex though. Maybe focusing on finishing the JS API would also cover the use cases for queries in findjsinstances.

mmarchini commented 4 years ago

Not working on this anymore, so closing. But if anyone starts working on this again we can reopen.