dyweb / blog

Dongyue Tech Blog
https://blog.dongyueweb.com
14 stars 7 forks source link

[post] ANTLR parser generator and visitor pattern #49

Open at15 opened 4 years ago

at15 commented 4 years ago

Type

Related

Description

While working on gegecece and writing SQL parser (ANTLR rule). The main problem is converting parser tree to AST. AST in SQL is (unresolved) logical plan. There are many ways to define the rule and to traverse the parser tree. A common pattern is called visitor pattern. However, when looking at code in some dbs e.g. tidb, es. they didn't build the plan in a very visitor way. This post tries to address the following questions

Update