[HN Gopher] ClangQL: A tool to run SQL-like query on C/C++ Code
___________________________________________________________________
ClangQL: A tool to run SQL-like query on C/C++ Code
Author : bubblehack3r
Score : 68 points
Date : 2024-04-07 13:13 UTC (9 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| giancarlostoro wrote:
| As cool as it looks, I have to ask: why?
| Hendrikto wrote:
| One obvious example would be refactoring. Many patterns are not
| (easily) expressible as regexes.
| eddd-ddde wrote:
| There is also ast grep [0]
|
| 0: https://ast-grep.github.io/guide/introduction.html
| giancarlostoro wrote:
| Ah so this is useful for IDE tooling and I guess someone
| grokking to see how much impact a change has, yeah makes
| sense.
| yodsanklai wrote:
| Wouldn't you use tools like clang-tidy for that use case?
| wouldn't it be more flexible and general? Also does this
| project let you rewrite code or only run queries?
| frabert wrote:
| I made a similar tool with the same name a couple of years ago :D
| https://github.com/frabert/ClangQL
| mgaunard wrote:
| Yours looks much better to be honest.
| cozzyd wrote:
| Wonder how it deals with templates
| morgante wrote:
| Cool to see another query language for source code! Yours is
| definitely closer to SQL than GritQL is.[0] I particularly like
| the count semantics.
|
| [0] https://github.com/getgrit/gritql
| ranger_danger wrote:
| Do you have any binaries? Stock ubuntu 22.04 does not have new
| enough versions of things to build this.
| wruza wrote:
| Why no line:col info?
| mgaunard wrote:
| I'm not too familiar with Rust, but took a look at the Cargo.lock
| file of this project.
|
| It depends on half the universe for some reason, sometimes
| multiple versions of the same library. And that doesn't even
| include the main dependency which is libclang.
|
| Is the Rust ecosystem just dependency hell?
| lpribis wrote:
| > Is the Rust ecosystem just dependency hell?
|
| Not quite to the extent of the js ecosystem, but yes.
| Especially for a purported systems language there's a lefpad-
| esque problem of people making tiny and somewhat useless
| libraries to learn or pad their resume which then get depended
| on by the world.
| plasticeagle wrote:
| I think it's an inevitable outcome of a build system that makes
| it so easy to pull in packages - and so easy to create and
| publish them.
|
| This is why C++'s weakness - difficulty of consuming third
| party libraries - is actually a strength. If you have to work
| hard to get third party code in there, you tend to make much
| better choices and keep your dependencies to a minimum.
|
| In Rust, like JS and to a lesser extent Python also, there is
| no pressure to reduce dependencies. So you end up with this
| kind of a problem. Good luck upgrading one of those packages
| when its found to contain a bug.
___________________________________________________________________
(page generated 2024-04-07 23:00 UTC)