slaclab / lacquer

SQL Parser derived from Presto, written in Python with the PLY framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create query interface for Syntax Tree/IR

brianv0 opened this issue · comments

The Redbaron project has an Syntax Tree query interface:

https://redbaron.readthedocs.io/en/latest/querying.html

Which is partially implemented as such:
https://github.com/PyCQA/redbaron/blob/master/redbaron/base_nodes.py#L804

Conceivably, we should be able to use the Visitor pattern to implement this.

Where this will really potentially shine is basic pattern matching where writing a new visitor is a bit more work than it's worth.