TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Compiler frameworks for AST Transformations?

4 pointsby ianbertolaccialmost 9 years ago
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 comments

_RPMalmost 9 years ago
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 未加载
msdosalmost 9 years ago
<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>