Open leveryd opened 3 years ago
这个文件是从 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.
用 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.
欢迎随时移步 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.
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