On 12/06/2022 14:29, Domingo Alvarez Duarte wrote:
Hello Lorenzo !
Hello Domingo!
From a superficial POV it seems most of your links are about classic parsing based on grammars expressed in a formal way, possibly using PEGs. As I said, I can't manage modifying/creating grammars to do what I want reliably and I don't have time to learn how to do that or to use PEGs. And neither can I afford to delve into huge codebases to extract a useful snippet. However, thanks for the effort and the links. Maybe some will prove useful for my use case. Anyway, should I find the time to learn PEGs (I tried years ago, just to be able to use LPEG, but the learning curve vs my free time proved too steep - maybe in another life :-), those references look very interesting.You've not LPeg but thereis the "re" module where you can write in a kind of EBNF, I would recomend https://github.com/edubart/lpegrex the author has done a parser for Lua https://github.com/edubart/lpegrex/blob/main/parsers/lua.lua and C11 https://github.com/edubart/lpegrex/blob/main/parsers/c11.lua that really parses real C projects like sqlite3 amalgamation. For manipulating C structures then there is a somehow pure Luajit implementation of LPeg https://github.com/sacek/LPegLJ . An also in pure Lua https://github.com/pygy/LuLPeg . Then there is tools to analyze/visualize grammars https://www.bottlecaps.de/rr/ui and https://www.bottlecaps.de/convert/ and it's parser generator https://www.bottlecaps.de/rex/ in several languages. For easy iterative testing grammars there is several online playgrounds: - cpp-peglib https://yhirose.github.io/cpp-peglib/ - peggy https://peggyjs.org/online.html - pest https://pest.rs/ I'm looking at this lightweight project that's promising too https://github.com/ChrisHixon/chpeg/ . Then there is this ones https://en.wikipedia.org/wiki/Comparison_of_parser_generators
Cheers !
Cheers!