Built-in C ++ interpreter for processing data in a compiled program

I have a C ++ program that creates a large amount of data stored in standard C ++ containers. I would like to be able to start the C ++ interpreter from my binary program and open a REPL session to manage this data. Preferably, I would like to use the modern C ++ 11 syntax. Is this possible? Is this possible for development in Visual Studio?

I heard about Ch, but it seems to only implement part of the C ++ 98 syntax.

I heard about Kling, but if my memory helps me well, one of the Cling developers answered this question negatively in Google TechTalks 2012. Is this accurate?

+4
source share
2 answers

There is another REPL on the shell command line. This is a bash script that decorates a piece of code using a regular C ++ template and call compiler. It has several additional libraries to make it work like AWK and handle FP ranges / expressions. Not sure if this is easy to embed. Link I know that soon he will have built-in processing of large memory tables (db-like). Examples from the docs:

// Classic pipe. Alogorithms are from std:: scc 'vector<int>{3,1,2,3} | sort | unique | reverse' {3, 2, 1} // Assign 42 to 2..5 scc 'vint V=range(0,9); range(V/2, V/5) = 42; V' {0, 1, 42, 42, 42, 5, 6, 7, 8, 9} // Find (brute force algorithm) maximum of `cos(x)` in interval: `8 < x < 9`: scc 'range(8, 9, 0.01) * cos || max' -0.1455 // Integrate sin(x) from 0 to pi scc 'auto d=0.001; (range(0,pi,d) * sin || add) * d' 2 
+1
source

Although this is not an interpreter, the Console from RuntimeCompiledC ++ can satisfy your needs (it may take a little effort to work as a more convenient REPL editor), especially since it uses the built-in compiler in the system, you can get C ++ 11 (although on Windows, I'd recommend it for GCC / Clang over MSVC for better C ++ 11 support).

As an added bonus, it will work much faster than the interpreted code.

+1
source

All Articles