任何教程嵌入Clang作为脚本解释器到C ++代码? [英] Any tutorial for embedding Clang as script interpreter into C++ Code?

查看:305
本文介绍了任何教程嵌入Clang作为脚本解释器到C ++代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有llvm或clang的经验,但。从我读的俚语据说是很容易嵌入维基百科 - 俚语,但是,我没有找到任何教程如何实现这一点。那么是否可以通过JIT编译并在运行时执行用户定义的代码来为c ++应用程序的用户提供脚本功能?是否可以调用应用程序自己的类和方法并共享对象?

I have no experience with llvm or clang, yet. From what I read clang is said to be easily embeddable Wikipedia-Clang, however, I did not find any tutorials about how to achieve this. So is it possible to provide the user of a c++ application with scripting-powers by JIT compiling and executing user-defined code at runtime? Would it be possible to call the applications own classes and methods and share objects?

编辑:我喜欢类似C语言的脚本语言C ++本身)

edit: I'd prefer a C-like syntax for the script-languge (or even C++ itself)

推荐答案

我不知道任何教程,但在Clang源中有一个示例C解释器可能有帮助。您可以在这里找到: http://llvm.org/viewvc/llvm-project / cfe / trunk / examples / clang-interpreter /

I don't know of any tutorial, but there is an example C interpreter in the Clang source that might be helpful. You can find it here: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/

如果你使用脚本语言,你可能不会有太多的语法选择路线。 Clang只解析C,C ++和Objective C.如果你想要任何变体,你可能会为你切出你的工作。

You probably won't have much of a choice of syntax for your scripting language if you go this route. Clang only parses C, C++, and Objective C. If you want any variations, you may have your work cut out for you.

这篇关于任何教程嵌入Clang作为脚本解释器到C ++代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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