开发者

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

开发者 https://www.devze.com 2023-03-06 04:51 出处:网络
开发者_Python百科I found something similar here: Where can I find standard BNF or YACC grammar for C++ language?
开发者_Python百科

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?


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.


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


Depending on your task, you might want to use an existing C++ frontend instead.

The EDG Compiler Frontend and the CLang Frontend have both been designed so as to be used independently from "pure compilation".

CLang notably features accurate location of tokens and for example includes "rewrite" tools that can be used to modify existing code.

0

精彩评论

暂无评论...
验证码 换一张
取 消