Repository of BNF Grammars?
Asked Answered
Q

5

26

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.

Quartersaw answered 2/12, 2008 at 16:6 Comment(0)
I
6

There are some links from w:BNF#Language Grammars.

I also found a page that lists grammars for Objective C.

Identification answered 2/12, 2008 at 16:11 Comment(0)
X
6

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.

Xeres answered 2/12, 2008 at 16:17 Comment(1)
The issue with reusing the grammar that is used by the MySQL server is that is depends on the tokens generated by the lexer. The lexer, having ~115 members, is neither easy to use nor easy to replace.Bashkir
K
3

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.

Kinesiology answered 2/12, 2008 at 16:39 Comment(0)
L
3

I also searched this and i collected this repository

http://slps.github.io/zoo/

Leis answered 15/8, 2015 at 8:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.