duanmao2774 2019-05-05 17:23
浏览 547

我正在使用Antlr4创建一种语言,然后使用该语言生成LLVM IR。 我是否需要为访客事件手写LLVM IR?

While learning Antlr4, I used Golang as a target language, so a statement in my toy language like:

$myVar = 10
$myVar + 5

Would translate to some Golang code that generates "15" for the result

However, as far as I can see, there isn't an LLVM IR target for ANTLR, so the question is: what are my options?

1) Generate C/C++ and then use it to emit LLVM IR?
2) Try to find a Golang LLVM IR emitter?
3) Keep using the generated Go lexer/parser but hand-write LLVM IR?

I tried to go through the LLVM documentation and watched a few videos on LLVM< but they all seem to generate C/C++ and then communicate with the API that way. Not sure if they do that because that's what they know or if it's because that's the only way.

Thanks in advance for any insights!

  • 写回答

1条回答 默认 最新


      相关推荐 更多相似问题


      • ¥15 结构体数组文件读取问题
      • ¥15 写c++代码,第7题说一下使用的计算方法
      • ¥15 postman接口自动化测试报告实践总结
      • ¥15 有关c++的问题,利用相关知识
      • ¥15 求香农编码和解码的matlab代码
      • ¥20 ROS中的TEB局部规划问题
      • ¥20 关于#matlab#的问题:要求测出上面图片中所有同心圆的半径
      • ¥20 epanet软件运行问题
      • ¥15 Python 文件读取
      • ¥60 dpabi进行Alff计算时脑池有干扰信号