Extending PostgreSQL with a Domain-Specific Language (DSL) - Development

From: Tom Mercha <mercha_t(at)hotmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Extending PostgreSQL with a Domain-Specific Language (DSL) - Development
Date: 2019-07-05 07:55:15
Message-ID: AM6PR04MB554457D6A1CA6EFFB96C9F8EF4F50@AM6PR04MB5544.eurprd04.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Hackers

I am interested in implementing my own Domain Specific Language (DSL) using PostgreSQL internals. Originally, the plan was not to use PostgreSQL and I had developed a grammar and used ANTLRv4 for parser work and general early development.

Initially, I was hoping for a scenario where I could have PostgreSQL's parser to change grammar (e.g. SET parser_language=SQL vs. SET parser_language=myDSL) in which case my ANTLRv4 project would override the PostgreSQL parser module. I guess another direction that my project could take is to extend PostgreSQL's SQL parser to factor in my DSL keywords and requirements.

To make matters more complicated, this version of ANTLR does not support code generation to C, but it does support generation to C++. Integrating the generated C++ code requires making it friendly to PostgreSQL e.g. using Plain Old Data Structures as described here https://www.postgresql.org/docs/9.0/extend-cpp.html, which seems to be suggesting to me that I may be using the wrong approach towards my goal.

I would be grateful if anyone could provide any general advice or pointers regarding my approach, for example regarding development effort, so that the development with PostgreSQL internals can be smooth and of a high quality. Maybe somebody has come across another DSL attempt which used PostgreSQL and that I could follow as a reference?

Thanks in advance.

Best,
Tom

[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-green-avg-v1.png]<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=oa-4885-a> Virus-free. www.avg.com<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=oa-4885-a>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2019-07-05 08:32:15 Re: Add client connection check during the execution of the query
Previous Message Peter Eisentraut 2019-07-05 07:48:47 Re: make libpq documentation navigable between functions