简体   繁体   English

在python中解析c ++

[英]parsing c++ in python

I'm looking to parse c++ code files in python. 我正在寻找解析python中的c ++代码文件。 I'm mostly concerned with only the function declarations, not the definitions. 我主要只关注函数声明,而不关注定义。 The kind of output GCCXML gives seems perfect to me but the thing is I can't get GCCXML to work, I can't find proper documentation. GCCXML提供的输出对我来说似乎很完美,但问题是我无法使GCCXML正常工作,找不到合适的文档。 All the articles I found online are old and possibly outdated. 我在网上找到的所有文章都是陈旧的,可能已经过时了。

Can anyone suggest any other alternative? 谁能建议其他选择? Or and updated links regarding GCCXML. 或和有关GCCXML的更新链接。

I'm using Python 3.4.2 and IDLE. 我正在使用Python 3.4.2和IDLE。

You may want to have a look at clang : it provides a library which provides full access to the compilers AST. 您可能想看看clang :它提供了一个库,该库提供对编译器AST的完全访问权限。 I seem to recall there was a python binding but I haven't used it. 我似乎记得有一个python绑定,但我没有使用它。

Clang有一个API,可用于代码完成以及带有python绑定的AFAIK。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM