cs01 / cs01/pygdbmi

Consider using a real language parser to parse MI output

Open
#75 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
260
Forks
53
PR merge metrics
No merged PRs in 30d

Description

**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.
>
> * https://github.com/lark-parser/lark
> * https://lark-parser.readthedocs.io/en/latest/json_tutorial.html
> * https://www.lark-parser.org/ide/#
> * https://www.lark-parser.org/Lark.js/index.html

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:**
* OS: All
* pygdbmi version (`pip freeze` output): `master` pre-0.10.0.3.

**Additional context**
N/A

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the regular-expression code that parses GDB MI output and compare its behavior with the referenced Rust grammar and Lark documentation. Done means replacing the current parsing approach without visible user-facing changes, while preserving existing output handling and checking for the expected performance improvements.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.