如何在不编译的情况下执行c++代码?

时间:2021-09-01 20:44:52

In order to pass some code to an application created with C++ I have used a C++ open source code which acted as a TCL interpreter. So I could create a file, in there put some XML data and in some tags some TCL code. Finally it is possible to read the file configure some structure and execute the TCL script snippets from the XML file in appropriate places. In order to not use C++ and TCL simultaneously I ask the following:

为了将一些代码传递给使用c++创建的应用程序,我使用了一个c++的开放源代码,它充当了一个TCL解释器。我可以创建一个文件,在里面放一些XML数据,在一些标签中加入一些TCL代码。最后,可以读取文件,配置一些结构,并在适当的位置执行来自XML文件的TCL脚本片段。为了不同时使用c++和TCL,我提出以下问题:

Is there an open-source C++ code that can execute a C++ code without compiling? In other words is there a C++ interpreter.

有没有一种开源的c++代码可以在不编译的情况下执行c++代码?换句话说,这里有一个c++解释器。

3 个解决方案

#1


14  

CINT

CINT

What is CINT?

CINT是什么?

CINT is an interpreter for C and C++ code. It is useful e.g. for situations where rapid development is more important than execution time. Using an interpreter the compile and link cycle is dramatically reduced facilitating rapid development. CINT makes C/C++ programming enjoyable even for part-time programmers.

CINT是C和c++代码的解释器。例如,对于快速开发比执行时间更重要的情况,它是有用的。使用解释器,编译和链接循环极大地降低了快速开发的速度。CINT让C/ c++编程变得有趣,即使是兼职程序员也不例外。

CINT is written in C++ itself, with slightly less than 400,000 lines of code. It is used in production by several companies in the banking, integrated devices, and even gaming environment, and of course by ROOT, making it the default interpreter for a large number of high energy physicists all over the world.

CINT是用c++编写的,代码略少于40万行。它被银行、集成设备、甚至游戏环境中的几家公司用于生产,当然还有ROOT用户,这使它成为世界上大量高能量物理学家的默认解释器。

#2


9  

I must admit I didn't expect there to be one, but a search has revealed the following:

我必须承认,我并没有想到会有这样的结果,但通过搜索,我发现了以下事实:

Ch

Ch

However:

然而:

Ch (pronounced /ˌsiːˈeɪtʃ/) is a cross-platform C and C++ interpreter. It is provided by SoftIntegration, Inc for C/C++ users. Ch is useful for scripting, shell programming, 2D/3D plotting, numerical computing, and can be embedded in other applications to add scripting capability. Ch can be used for both server-side and client-side web development. It runs under Windows, Linux, Mac OS X and some versions of Unix. Ch supports C90 and major C99 features, but it doesn't support full C++ features.

Ch(发音/ˌsiːˈeɪtʃ/)是一个跨平台的C和c++翻译。它是由SoftIntegration, Inc为C/ c++用户提供的。Ch对于脚本编程、shell编程、2D/3D绘图、数值计算非常有用,并且可以嵌入到其他应用程序中以添加脚本功能。Ch可以用于服务器端和客户端web开发。它在Windows、Linux、Mac OS X和一些Unix版本下运行。Ch支持C90和主要的C99特性,但不支持完整的c++特性。

Source

So check it covers the features you need.

所以检查它是否包含了你需要的特性。

#3


7  

Yes. Check this out: http://root.cern.ch/drupal/content/cint (it is free software, too).

是的。看看这个:http://root.cern。ch/drupal/content/cint(也是免费软件)。

Apart from that: you can certainly find a better solution than embedding a C++ interpreter, especially with far more light-weight, easily embedabble languages like Lua, Python, etc.

除此之外:您当然可以找到比嵌入c++解释器更好的解决方案,特别是使用更轻的、容易嵌入的语言,如Lua、Python等。

#1


14  

CINT

CINT

What is CINT?

CINT是什么?

CINT is an interpreter for C and C++ code. It is useful e.g. for situations where rapid development is more important than execution time. Using an interpreter the compile and link cycle is dramatically reduced facilitating rapid development. CINT makes C/C++ programming enjoyable even for part-time programmers.

CINT是C和c++代码的解释器。例如,对于快速开发比执行时间更重要的情况,它是有用的。使用解释器,编译和链接循环极大地降低了快速开发的速度。CINT让C/ c++编程变得有趣,即使是兼职程序员也不例外。

CINT is written in C++ itself, with slightly less than 400,000 lines of code. It is used in production by several companies in the banking, integrated devices, and even gaming environment, and of course by ROOT, making it the default interpreter for a large number of high energy physicists all over the world.

CINT是用c++编写的,代码略少于40万行。它被银行、集成设备、甚至游戏环境中的几家公司用于生产,当然还有ROOT用户,这使它成为世界上大量高能量物理学家的默认解释器。

#2


9  

I must admit I didn't expect there to be one, but a search has revealed the following:

我必须承认,我并没有想到会有这样的结果,但通过搜索,我发现了以下事实:

Ch

Ch

However:

然而:

Ch (pronounced /ˌsiːˈeɪtʃ/) is a cross-platform C and C++ interpreter. It is provided by SoftIntegration, Inc for C/C++ users. Ch is useful for scripting, shell programming, 2D/3D plotting, numerical computing, and can be embedded in other applications to add scripting capability. Ch can be used for both server-side and client-side web development. It runs under Windows, Linux, Mac OS X and some versions of Unix. Ch supports C90 and major C99 features, but it doesn't support full C++ features.

Ch(发音/ˌsiːˈeɪtʃ/)是一个跨平台的C和c++翻译。它是由SoftIntegration, Inc为C/ c++用户提供的。Ch对于脚本编程、shell编程、2D/3D绘图、数值计算非常有用,并且可以嵌入到其他应用程序中以添加脚本功能。Ch可以用于服务器端和客户端web开发。它在Windows、Linux、Mac OS X和一些Unix版本下运行。Ch支持C90和主要的C99特性,但不支持完整的c++特性。

Source

So check it covers the features you need.

所以检查它是否包含了你需要的特性。

#3


7  

Yes. Check this out: http://root.cern.ch/drupal/content/cint (it is free software, too).

是的。看看这个:http://root.cern。ch/drupal/content/cint(也是免费软件)。

Apart from that: you can certainly find a better solution than embedding a C++ interpreter, especially with far more light-weight, easily embedabble languages like Lua, Python, etc.

除此之外:您当然可以找到比嵌入c++解释器更好的解决方案,特别是使用更轻的、容易嵌入的语言,如Lua、Python等。