BNF 语法存储库?
在哪里可以找到流行语言的巴科斯范式或 BNF 语法? 每当我进行搜索时,我都不会出现太多,但我认为它们一定会在某个地方发布。 我最感兴趣的是 Objective-C 和 MySQL 的一个。
Is there a place I can find Backus–Naur Form or BNF grammars for popular languages? Whenever I do a search I don't turn up much, but I figure they must be published somewhere. I'm most interested in seeing one for Objective-C and maybe MySQL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您必须搜索用于创建语法的工具:“lex/yacc 语法”、“antlr 语法”“铁路图”
http://www.antlr3.org/grammar/list.html
语法文件
这是一些Objective-c
http://www.omnigroup.com/mailman/archive/macosx-dev/2001-March/022979.html
http://www.cilinder.be/docs/next/NeXTStep/3.3/nd/Concepts/ObjectiveC/B_Grammar/Grammar.htmld/index.html
https://github.com/pornel/objc2grammar
python
javascript
http://tomcopeland.blogs.com/EcmaScript.html
http://www.ccs.neu.edu/home/dherman/javascript/
ruby
you have to search on tools used to create grammars: "lex/yacc grammar", "antlr grammar" "railroad diagram"
http://www.antlr3.org/grammar/list.html
Here's some grammar files
objective-c
http://www.omnigroup.com/mailman/archive/macosx-dev/2001-March/022979.html
http://www.cilinder.be/docs/next/NeXTStep/3.3/nd/Concepts/ObjectiveC/B_Grammar/Grammar.htmld/index.html
https://github.com/pornel/objc2grammar
python
javascript
http://tomcopeland.blogs.com/EcmaScript.html
http://www.ccs.neu.edu/home/dherman/javascript/
ruby
FWIW,MySQL语法文件(
mysql-server/sql/sql_yacc.y
)是开源的,可以在launchpad.net上浏览(尽管它有点慢,当我尝试拉起时出现错误)具体文件)。另外,整个 MySQL Server 源代码的快照可以从 dev.mysql.com< 下载/a>.
FWIW, the MySQL grammar file (
mysql-server/sql/sql_yacc.y
) is open source and browseable at launchpad.net (though it's a bit slow and I got an error when I tried to pull up the specific file).Also, a snapshot of the whole MySQL Server source is downloadable from dev.mysql.com.
有一些来自 w:BNF#Language Grammars 的链接。
我还发现了一个页面,列出了 Objective C 的语法。
There are some links from w:BNF#Language Grammars.
I also found a page that lists grammars for Objective C.
IIRC、BNF 语法与 yacc/bison 想要的输入非常不同,这确实很烦人:) 如果您打算将这些文件提供给解析器生成器,您可能需要查找适当格式的文件。 我记得曾经看到过 Java、JavaScript 和 C++ 的此类文件。 可能分别是 Eclipse、Firefox 和 GCC 的一部分,但我不太记得了。 我假设您可以通过查找使用该语言的开源项目来找到几乎任何解析器输入文件。
IIRC, BNF grammars are just different enough from what yacc/bison want as input to be really annoying :) If you intend to feed these files into a parser generator, you may want to look for files in the appropriate format. I recall seeing such files for Java, JavaScript and C++ at one point. Probably as part of Eclipse, Firefox and GCC, respectively, but I can't remember for sure. I would assume you can find pretty much any parser input file by finding an open source project that uses that language.
我也搜索了这个并收集了这个存储库
http://slps.github.io/zoo/
I also searched this and i collected this repository
http://slps.github.io/zoo/