Hacker News new | past | comments | ask | show | jobs | submit login

> We utilized libclang to automatically extract source code from Postgres, just like we've done for pg_query.

How?




(author here)

Just realized that could use a more direct link (will add), here is the relevant section from our post on pg_query:

https://pganalyze.com/blog/pg-query-2-0-postgres-query-parse...

The quick summary: Call libclang using the Ruby FFI bindings to parse C code into AST and locate function/symbol definitions, build a tree of dependent code, remove all code that is not referenced + add a few stubs where there is direct disk access.


Thanks for that info. I was looking recently at extracting the parsing layer so this will be pretty interesting.


I believe DuckDB has also extracted the Postgres parser into a separate package.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: