Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where did the original ebnf file come from? #1152

Open
leveryd opened this issue Jan 12, 2021 · 4 comments
Open

Where did the original ebnf file come from? #1152

leveryd opened this issue Jan 12, 2021 · 4 comments
Labels
question Further information is requested

Comments

@leveryd
Copy link

leveryd commented Jan 12, 2021

Question

我正在做一些sql parser的工作,需要支持其他oracle、postgresql等的语法。因为性能要求,所以有可能仿照parser手写词法解析、yacc做语法解析的方式来完成。

我在历史记录里看到ebnf文件,好奇这份文件是从哪里找到的,还是你们自己写的呢?

https://github.com/pingcap/parser/blob/81106e4996bfdaaf5f0ef87ac8280d03b719594d/compatibility_reporter/mysql80_bnf.txt


I am doing some sql parser work and need to support syntax of other oracle, postgresql etc. Because of the performance requirements, it is possible to do this by emulating the way parser handwrites lexical parsing and yacc does syntax parsing.

I saw the ebnf file in the history and was curious where this file was found, or did you write it yourselves?

https://github.com/pingcap/parser/blob/81106e4996bfdaaf5f0ef87ac8280d03b719594d/compatibility_reporter/mysql80_bnf.txt

@kennytm kennytm added the question Further information is requested label Jan 12, 2021
@tangenta
Copy link
Contributor

tangenta commented Jan 21, 2021

这个文件是从 MySQL 8.0 的语法文件转换而成的。


This file is converted from the MySQL 8.0 syntax file.

@leveryd
Copy link
Author

leveryd commented Jan 21, 2021

这个文件是从 MySQL 8.0 的语法文件转换而成的。

是怎么转的?有脚本么?

我对照这两个文件,似乎是 去掉了所有的声明部分、语法中规则中的 {...} 代码,只保留了 %%...%% 中的部分语法。


How is it transferred? Is there a script?

When I compare the two files, it seems to remove all the declarative parts, the {...} in the rules in the syntax code, and only kept part of the syntax in %%... %% of the syntax.

@tangenta
Copy link
Contributor

tangenta commented Jan 21, 2021

bison 指定 -v 参数传入语法文件,然后将不需要的部分删掉就行了。


Use bison to specify the -v parameter to pass in the syntax file, and then just delete the parts you don't need.

@tangenta
Copy link
Contributor

tangenta commented Jan 21, 2021

欢迎随时移步 tidb-community slack 的 sig-sql-infra channel 进一步讨论。


Feel free to move to the sig-sql-infra channel of the tidb-community slack for further discussion.

@tangenta tangenta changed the title ebnf原始文件是从哪里来的? Where did the original ebnf file come from? Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants