Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

searching for a BNF (for yacc) grammar of C++

Tags:

c++

I found something similar here: Where can I find standard BNF or YACC grammar for C++ language?

But the download links don't work anymore, and I want to ask if somebody know where I can download it now?

like image 611
develhevel Avatar asked May 13 '11 14:05

develhevel


2 Answers

C++ is not a context-free language and therefore cannot be accurately parsed using a parser like BNF or yacc. However, it is possible to parse a superset of the language with those tools, and then apply additional contextual processing to the parsed structure.

like image 185
kqnr Avatar answered Nov 01 '22 04:11

kqnr


Looking here: http://www.parashift.com/c++-faq-lite/compiler-dependencies.html#faq-38.11, I found this: http://www.computing.surrey.ac.uk/research/dsrg/fog/CxxGrammar.y

like image 3
Robᵩ Avatar answered Nov 01 '22 04:11

Robᵩ