douchi0028 2014-03-21 19:27
浏览 2

转编译为裸露的骨头C?

While watching some FOSDEM'14 presentations I found this one being particularly interesting. It is about the Go programming language and how it gives access to compiler's internal through packages. So basically you can write a program in Go that gets AST (abstract syntax tree) or more low level SSA (single static assignment) and analyze it, or transforms it into something else (like transcompiling it to JavaScript for example). I find it very interesting. I can remember a few other languages that do it: Vala (JavaScript transcompiler) and Boo another JavaScript transcompiler. Some languages provide parsing code to AST as a separate library, like Clang for C/C++/ObjC, ASIS for Ada, or CodeTools for Free Pascal, but it is not quite the same.

I'm thinking of making a Go transcompiler to bare bones C/C++ (to make it be more suitable for os development and just for the fun of it), do you think it is a good idea? Is there any other language that may be more easy to transcompile to bare bones C/C++?

  • 写回答

1条回答 默认 最新

  • doushi8599 2014-03-22 22:03
    关注

    The problem that occurs to me is garbage collection - if you've transcompiled to pure C/C++ then you either have to automatically insert the correct free() calls or your code will leak memory all over the place.

    评论

报告相同问题?

悬赏问题

  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败