TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Compiler frameworks for AST Transformations?

4 点作者 ianbertolacci将近 9 年前
Are there any compiler frameworks that tools to parse code (C&#x2F;C++ at a minimum), and analyse, transform, and manipulate the AST?<p>We&#x27;ve been using the Rose compiler framework (http:&#x2F;&#x2F;rosecompiler.org&#x2F;) in our group for some time. However, it&#x27;s not my favorite and I&#x27;d like to use an alternative.<p>I&#x27;ve been wondering if there was something similar that was better maintained and supported. LLVM seems like an obvious choice, but it&#x27;s too low level to be really effective. We would end up writing a lot more analysis to discover things that are obvious at high-level representations (&quot;Is that a for loop?&quot;).<p>Looking for something: 1) very accessible; other people should be able to build and use my transformations with relative ease. 2) well documented; no mysterious functions and types that I have to use. 3) easy-to-use&#x2F;intuitive (for compiler writers).<p>Thanks!

2 条评论

_RPM将近 9 年前
I think it is great that you are into this kind of stuff. I am as well, as I find it one of the most interesting things to do. &quot;The AST&quot; is subjective, however. We know it is a tree data structure, but most compilers implemented it differently. Also, AST generation is typically derived from the parsing stage, then the AST is taken to be compiled. I think you should look into GNU Bison.
评论 #11831664 未加载
msdos将近 9 年前
<a href="https:&#x2F;&#x2F;github.com&#x2F;cil-project&#x2F;cil" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cil-project&#x2F;cil</a>