[cfe-dev] Using Clang to import C++ source in an interpreter

Brian Hare via cfe-dev cfe-dev at lists.llvm.org
Sat Jan 2 16:47:13 PST 2016


I am working on an interpreter for a computer language of my own design, and I'd like to allow my language to directly import C++ files. 

I need a clang libtool for a project I am working on. I need a function that can take in a file name of a C++ source or header file and return a structure that represents the structure of the source file. Many IDE's have a source tree that shows the global variables, functions, classes, etc... that are defined in a C++ file. I need a functional version of that. What would the best way of producing such a function be? Would I make a clang libtool?  How would I structure the tool? Is there any code or tool that I could look at for guidance?      

I have seen a number of the simple clang-tool examples online, but I have no idea how to extend them to do what I want. 

Furthermore, once I get a tree of variables, functions, and such, is there some way to JIT compile the functions and call them passing data from my external program to the JITed functions and back again?

thanks,
Brian Hare
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160102/4d1f87e6/attachment.html>


More information about the cfe-dev mailing list