正在为C ++获取AST? [英] Getting AST for C++?
问题描述
我希望获得用于C ++的AST,然后可以与外部程序进行解析。那里有哪些程序可以为C ++生成AST?我不在乎它是以什么语言实现的或输出格式(只要它易于解析)。
I'm looking to get an AST for C++ that I can then parse with an external program. What programs are out there that are good for generating an AST for C++? I don't care what language it is implemented in or the output format (so long as it is readily parseable).
我的总体目标是转换C ++单元测试
My overall goal is to transform a C++ unit test bed to its corresponding C# wrapper test bed.
推荐答案
您可以使用铛,尤其是 libclang 解析C ++代码。这是一个非常高质量的手写库,用于词法分析,解析和编译C ++代码,但它也可以生成AST。
You can use clang and especially libclang to parse C++ code. It's a very high quality, hand written library for lexing, parsing and compiling C++ code but it can also generate an AST.
Clang 还支持C,Objective-C和Objective-C ++。 lang本身是用C ++编写的。
Clang also supports C, Objective-C and Objective-C++. Clang itself is written in C++.
这篇关于正在为C ++获取AST?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!