Embedded scripting languages
The following is a list of reasonably mature open source embedded scripting languages to use in your application.
Project name/link | Implementation language | GC | License | Notes |
---|---|---|---|---|
AngelScript | C++ | Ref. counting + cycle-detecting tracing GC | zlib | A statically typed curly brace language resembling C++ itself. |
Anko | Go | Tracing (Go's GC) | MIT | Scriptable interpreter with syntax similar to Go. |
BeanShell | Java | JVM's GC | Apache License 2.0 | An small, embeddable Java source code interpreter. Understands Java code with version 1.1 syntax, meaning no generics or lambdas, but extends Java with, e.g., method closures. A fork that supports generics is being merged. |
ChaiScript | C++ | Ref. counting | 3-clause BSD | A header-only C++14 interpreter library. |
Chibi Scheme | C | Tracing | 3-clause BSD | Implements R7RS small. |
CHICKEN Scheme | C | Tracing | 3-clause BSD | Implements R5RS (with some changes). R7RS support is a work in progress. Examples of embedding CHICKEN. |
Clasp | Common Lisp, C++ | MPS GC (Boehm-Weiser also supported) | LGPL 2+ | Full Common Lisp implementation well integrated with C++, using LLVM for the code generation, to integrate closely with C++ applications or libraries. |
Duktape | C | Ref. counting + cycle-detecting tracing GC | MIT | Implements JavaScript E5/E5.1. |
DWScript | Object Pascal (Delphi 2009 or later) | Ref. counting + cycle-detecting tracing GC | MPL 1.1, GPL 3 (JavaScript code generator) | Description. A statically typed Delphi/Free Pascal-like language. Can compile to JavaScript. |
Embeddable Common Lisp | Common Lisp, C | Boehm-Weiser GC | LGPL 2+ | Full Common Lisp implementation, available as a shared library libecl.so embeddable in any C, C++ or other application. |
Espruino | C | Tracing | MPL 2.0 | Implements a subset of JavaScript ES5 in a way suitable for embedded hardware with 8+ KiB RAM. |
GameMonkey Script | C++ | Tracing | MIT | Comes with C bindings. Similar to Lua, multithreaded. |
gluon | Rust | Tracing | MIT | Statically typed. Inspired by Lua, Haskell, and OCaml. Each executing gluon thread gets a separate heap. |
Go-Lua | Go | Tracing (Go's GC) | MIT | Implements a subset of Lua 5.2. |
GopherLua | Go | Tracing (Go's GC) | MIT | Implements Lua 5.1 with the added support for Go's channels. Lacks the debug hooks and several functions from the C version. |
GNU Guile | C | Boehm | LGPL 3+ | "Guile mostly implements R6RS." |
Gravity | C | Tracing | MIT | A class-based concurrent scripting language with a Swift-like syntax. |
Io | C | Tracing | 3-clause BSD | A prototype-based OO language. |
JerryScript | C | Tracing | Apache License 2.0 | A full ECMAScript 5.1 interpreter written in C99 and optimized for low memory consumption. Uses CMake. |
JRuby | Java | JVM's GC | Choice of EPL, GPL, and LGPL | An implementation of Ruby on the JVM. |
Jim Tcl | C | Tracing | 2-clause BSD | Largely compatible with Tcl 8.5 with its own additions. |
jsish | C | Ref. counting | MIT | A JavaScript ES 5.2+ interpreter. Internally structured after Tcl with an extensive C API. Features include subinterpreters, introspection, SQLite bindings, and a web framework with WebSocket support. The code is valid C and C++. |
JTcl | Java | Ref. counting | Various BSD-like | Tcl 8.4 with some 8.5 features for the JVM. |
Kawa | Java | JVM's GC | MIT | R7RS. Supports the javax.script API. Evaluating Scheme expressions from Java. |
LIL | C, Object Pascal (separate implementations) | None (no reference support) | zlib | A Tcl-like language incompatible with mainline Tcl. |
Lily | C | Ref. counting + GC | MIT | A language focusing on expressiveness and safety. |
Lua | C | Tracing | MIT | The reference implementation of what is likely the world's most popular embedded scripting language. Fast for an interpreter. Allows you to precompile scripts to bytecode. Versions 5.1-5.3, which are the ones used today, are not fully compatible with each other. |
luerl | Erlang | Tracing | Apache License 2.0 | An implementation of Lua 5.2 in pure Erlang with some features like goto absent. |
LuaJ | Java | JVM's GC | MIT | A Lua 5.2 spec-compliant interpreter written in Java for JME and JSE. Complies Lua directly to JVM bytecode. |
LuaJIT | C | Tracing | MIT | Fully compatible with Lua 5.1. Has a built-in C FFI library. Very fast. |
MicroPython | C | Tracing | MIT | Implements the Python 3.4 syntax and some of the core datatypes. |
Mono | C | Tracing | MIT and other | Implements the CLR. |
mruby | C | Tracing | MIT | A lightweight implementation of Ruby. Has a compile-time package manager. |
MY-BASIC | C | Ref. counting + cycle-detecting tracing GC | MIT | A Basic dialect with prototype-based OOP. |
Neko | C | Boehm | MIT | The NekoVM is a target for several compilers, including Haxe. |
otto | Go | Tracing (Go's GC) | MIT | Implements ES5 with some limitations. |
Pascal Script | Object Pascal | None (manual MM) | Custom non-copyleft | Statically typed. Implements "most of Object Pascal". Can't define new classes. |
Pawn | C | None (no heap allocation) | Apache License 2.0 with a clause to explicitly permit static linking | A curly-brace language with a small-footprint VM. Represents data as 4/8-byte "cells". Compiles to CPU-specific bytecode. More. |
pForth | C | None (manual MM) | Public domain | A dialect of Forth. |
PicoC | C | None (manual MM) | 3-clause BSD | Statically typed. Interprets a subset of C. |
Python | C | Ref. counting + cycle-detecting tracing GC | PSFL (BSD-like) | Embedding Python in Another Application. |
gmqcc/qcvm | C++ | None (no dynamic memory allocation) | MIT | A QuakeC compiler and VM. |
s7 | C | Tracing | 3-clause BSD | Implements a subset of R5RS/R7RS. Descended from TinyScheme. |
Shine | C | Tracing | MIT | A language based on Lua with additional safety and expressiveness features implemented as a fork of LuaJIT. |
SGScript | C | Ref. counting + tracing CG | MIT | Features include a built-in data serialization format, coroutines, class-based OOP, sandboxed evaluation, a built-in debugger and profiler. |
Squirrel | C++ | Ref. counting | MIT | A language inspired by Lua and JavaScript/Python. Has a Lua-like C++ API. Differentiates itself from Lua with the use of reference counting in place of Lua's tracing GC, a curly-brace syntax, built-in class-based OOP, and zero-indexed arrays. |
Tcl | C | Ref. counting | Tcl license (BSD-like) | An embeddable general-purpose scripting language with a rich C API. Has a cross-platform GUI toolkit called Tk. How to embed Tcl in C applications. |
TinyScheme | C | Tracing? | 3-clause BSD | Implements a subset of R5RS. |
Wren | C | Tracing | MIT | A small class-based performance-oriented scripting language. |
zygomys | Go | Tracing (Go's GC) | 2-clause BSD | An embedded Lisp for Go. Inspired by Clojure, but more oriented towards imperative programming. Has an infix syntax layer that looks like a subset of Go. |
See also
Contributing
Your contributions are welcome! I am looking for language implementations that are either actively maintained or largely "done" and have a free (libre) license. Non-copyleft licenses are preferred, but limited-scope copyleft (e.g., the LGPL for a VM or the GPL for a bytecode compiler that isn't needed at runtime) is fine. Please submit a pull request or create an issue to add a new language to the list.