cs01 / pygdbmi

A library to parse gdb mi output and interact with gdb subprocesses
https://cs01.github.io/pygdbmi
MIT License
221 stars 47 forks source link

Consider using a real language parser to parse MI output #75

Open barisione opened 2 years ago

barisione commented 2 years ago

Describe the bug Currently, we use regular expressions to parse the GDB MI output. In https://github.com/cs01/pygdbmi/pull/72#pullrequestreview-1066128398 Chad suggested we used a proper parser to do it:

NIce, this is much better!

Should we consider writing a grammar to simplify this more? Someone did this in rust for pygdbmi -- https://github.com/JP3BGY/gdbmi/blob/master/src/gdbmi_output.pest

We could use lark which has implementation in other languages for the same source .lark grammar.

I'm not keen to write a grammar (it's not something I've done since univeristy!) but, as we already have one we could use, this is a good idea.

To Reproduce N/A

Expected behavior No visible change to users (apart from performance improvements probably).

Screenshots N/A

Please complete the following information:

Additional context N/A

cs01 commented 2 years ago

Thanks for filing the issue. This is low priority as it’s not clear the trade offs would be worth it, but I thought it was an interesting idea.

It is unclear if there would be performance benefits (if we used a more performant language like rust there would be for sure).

It would reduce the amount of code we have to maintain, but then maybe make it difficult to fix bugs or have others contribute fixes since grammars have a higher learning curve than the parser.