LKscript - simple scripting everywhere.
LK is a simple but powerful scripting language that is designed to be small, fast, and easily embedded in other applications. It enables people to extend the built-in functionality of their programs, and provides a cross-platform standard library of function calls. The core LK engine, including lexical analyzer, parser, compiler, and virtual machine comprises roughly 6600 lines of ISO-standard C++ code, and is only dependent on the Standard C++ Library (STL), making it extremely lightweight and portable.
- Dynamically typed, functions are first-class values
- Support for arrays and tables (hashes)
- Large standard library of built-in functions
- API for extensions loadable at runtime
- Stack-based virtual machine with debugging hooks
- Written in standard C++11 and works on 32/64 bit Windows, Linux, OSX
- Embeds readily into GUI applications written in wxWidgets
The standard one:
Of course, more examples can be found in the manual.
View the manual here.
Check out the latest source code from: https://svn.lkscript.org/lk/trunk
An example of calling the LK language engine from a C++ command-line program:
Aron P. Dobos
Copyright (c) 2017, Alliance for Sustainable Energy, LLC.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the Alliance for Sustainable Energy, LLC.