How to execute C ++ code without compiling it?

To pass some code to an application built using C ++, I used open source C ++, which acted as a TCL interpreter. So I could create a file, some XML data was placed there, and TCL code in some tags. Finally, you can read the file by configuring some structure and executing the TCL script fragments from the XML file in the appropriate places. In order not to use C ++ and TCL at the same time, I ask the following:

Is there any open source C ++ code that can execute C ++ code without compilation? In other words, there is a C ++ interpreter.

+7
c ++ interpreter
source share
3 answers

Cint

What is a cint?

CINT is an interpreter for C and C ++ code. This is useful, for example, for situations where rapid development is more important than lead time. Using the interpreter significantly reduces the compilation and communication cycle, which contributes to rapid development. CINT makes C / C ++ programming enjoyable even for part-time programmers.

CINT is written in C ++ with just under 400,000 lines of code. It is used in production by several companies in banking, integrated devices and even the gaming environment and, of course, ROOT, which makes it the default interpreter for a large number of high-energy physicists around the world.

+14
source share

I must admit that I did not expect that there would be one, but the search showed the following:

Ch

But:

Ch (pronounced / ˌsiːeΙͺtΚƒ /) is a cross-platform interpreter of C and C ++. It is provided by SoftIntegration, Inc for C / C ++ users. Ch is useful for writing scripts, programming shells, building 2D / 3D, numerical calculations, and can be built into other applications to add scripting capabilities. Ch can be used both for web development on the server side and on the client side. It runs on Windows, Linux, Mac OS X and some versions of Unix. Ch supports C90 and the basic functions of C99, but does not support the full capabilities of C ++.

A source

Therefore, check that it covers the required functions.

+9
source share

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

Also: you may find a better solution than embedding the C ++ interpreter, especially with much lighter, more easily embeddable languages ​​like Lua , Python , etc.

+7
source share

All Articles