About ChaiScript

ChaiScript is the first and only scripting language designed from the ground up with C++ compatibility and modern design in mind. It is an ECMAScript-inspired, embedded functional-like language.

ChaiScript is licensed under the BSD license.

Download

Due to an increased release schedule, and the nature of ChaiScript being a header-only library, binary releases will be made less often. Previous releases can be found on github.

Version: 4.2.0 Released: 12/1/2012
(Requires Boost)
Source (tar.bz2)
Source (zip)

Version: 5.2.0 Released: 12/1/2012
(Requires C++11 Compiler)
Source (tar.bz2)
Source (zip)

Creating and Loading Compiled Format

I am starting a project that I would like to use ChaiScript in however I will require that I am able to publish the compiled version (IL?) of the script files. The script engine is going to be used for most of the non public code as well as allowing users to modify the application.

So I guess what I am looking for is a way to do something like the following.
vm.SaveILToFile("FileName.il");

ChaiScriptIL il = vm.LoadILFromFile("FileName.il");
vm.evalIL(il);

or something similar. Is this a possibility?

Thanks,

ChaiScript does not have an

ChaiScript does not have an IL. Interpreter objects exist simply in memory as the script is parsed, as C++ objects.

You are welcome to take the eval tree from a script parse and write a serializer/deserializer that can perform the desired action.

Is there positively this possibility?

I want to make sure that you are 100% sure that this is possible. I have been looking into the header files and I think I might have an Idea of where to add the functionality in the chaiscript_parser.hpp file. So, I would like to continue with the development of my project at the moment, and I would like to leave this for later. So, I just wanted to make sure it is possible before I further invest my time into using this script language. As this is one of my few requirements.

Thanks,

Do you happen to have any documentation on the eval tree?

We don't have much

We don't have much documentation on it, just the example and unit test for it, actually.

https://github.com/ChaiScript/ChaiScript/blob/master/unittests/reflectio...

Well, and the doxygen http://www.chaiscript.com/doxygen/structchaiscript_1_1_a_s_t___node.html

To be fair, it would be a pain to serialize it, and you'd have to do it on a function-by-function basis as it stands.

My partner on this project suggested that you might want to just zip the source with a password and unzip at application start up. That would probably be the most simple solution.

-Jasno

Thanks for the suggestion.

I had previously thought about this as a possibility. The reason I was hoping for a pre parsed solution is so that I could skip parsing on load and still protect my code in a sense. While at the same time pushing my code through a cipher will protect my code it will also add processing time.

Also, I am not going to want to have my script ever on the machine in a decrypted form except in memory, I will either need to load large amounts of the code into memory or decrypt it everytime I need to load more code.

So, this is not my first choice however it is definitely a possibility. Thanks for the information.

Support ChaiScript by sharing it with your friends: