Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scripting language for C/C++?

Tags:

c++

c

scripting

rad

Is there a scripting language for C++ (like perl) which can be used for rapid development and use some tool which can convert into C/C++ program to get higher performance for deployment?

EDIT:
Based on some commented, let me clarify the question. I should be able to convert script into C/C++ program or binary without modifying my script.

like image 792
rjoshi Avatar asked Oct 03 '09 14:10

rjoshi


4 Answers

With a C/C++ interpreter you can use C/C++ as a scripting language.

  • Ch: http://www.softintegration.com/

    Commmercial C/C++ interpreter with a free Standard Edition. Has support for various popular libraries and windowing toolkits.

  • CINT: http://root.cern.ch/drupal/content/cint

    Actively developed open-source (MIT license) C/C++ interpreter. Developed as part of the ROOT environment at the CERN. Used by many physicist.

  • ccons: https://github.com/asvitkine/ccons

    An interactive C console which employs LLVM and its new C frontend (clang). Under active development

  • UnderC: http://home.mweb.co.za/sd/sdonovan/underc.html

    An open-source (LGPL) C++ interpreter. Seems to be a bit dated (2002).

Note: So far, I have tried only Ch and CINT. I have added ccons and UnderC to make the list more complete.

like image 78
f3lix Avatar answered Oct 14 '22 10:10

f3lix


You may try Lua quite often used with C++ in games industry. It has a small memory footprint and is quite mature, has a great library... just give it a try.

hm... I do not understand what you want to achieve: do you want to find a scripting language that will somehow, magically be converted into c++ source? Or what you really want is just an option to create an executable from the script? If the latter - then you may try py2Exe.

like image 38
Maciek Talaska Avatar answered Oct 14 '22 10:10

Maciek Talaska


Anybody interested in a scripting language that is (mostly) very similar to C++, may want to take a look at angelscript (ZLIB):

The AngelCode Scripting Library, or AngelScript as it is also known, is an extremely flexible cross-platform scripting library designed to allow applications to extend their functionality through external scripts. It has been designed from the beginning to be an easy to use component, both for the application programmer and the script writer.

Efforts have been made to let it call standard C functions and C++ methods with no need for proxy functions. The application simply registers the functions, objects, and methods that the scripts should be able to work with and nothing more has to be done with your code. The same functions used by the application internally can also be used by the scripting engine, which eliminates the need to duplicate functionality.

For the script writer the scripting language follows the widely known syntax of C/C++ (with minor changes), but without the need to worry about pointers and memory leaks. Contrary to most scripting languages, AngelScript uses the common C/C++ datatypes for more efficient communication with the host application.

For more info, check out: http://www.angelcode.com/angelscript/sdk/docs/manual/index.html

like image 25
none Avatar answered Oct 14 '22 11:10

none


Many projects combine e.g. C++ and Python -- see for example boost.python.

I prefer R and use the Rcpp interface from R to C++.

Either case gives you your scripting language for prototyping and easy 'glue' to C++ for performance.

like image 22
Dirk Eddelbuettel Avatar answered Oct 14 '22 09:10

Dirk Eddelbuettel