Java中的C源代码AST解析器 [英] C source code AST parser in Java

查看:145
本文介绍了Java中的C源代码AST解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找可以从中创建全面的AST的C源代码解析器.

I'm looking for an C source code parser that can create a comprehensive AST from it.

最好是Java库(我不想在这里使用Python-> http://code.google.com/p/pycparser/)

Preferably a Java library (I'd rather not have to use Python here -> http://code.google.com/p/pycparser/)

推荐答案

对于您来说,使用ANTLR并使其基于现有ANTLR语法生成AST可能是最简单的方法,例如.

It may well be easiest for you to use ANTLR and get it to generate an AST based on an existing ANTLR grammar, e.g. the source.

ANTLR在此处具有Java API: http://www.antlr.org/api /Java/index.html

ANTLR has a Java API here: http://www.antlr.org/api/Java/index.html

这篇关于Java中的C源代码AST解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆