Embed a lightweight scripting engine into a C or C++ desktop app so users can write automation scripts without knowing C.
Add a plugin system to a game engine using Gravity as the scripting layer, letting designers write game logic in readable code.
Build an iOS or Android app builder tool that uses Gravity as its user-facing scripting runtime.
Embedding Gravity into your own app requires calling its compiler and VM APIs from C, which takes reading of the embedding API docs.
Gravity is a programming language created to be small enough to embed inside other applications. It is written in C with no external dependencies, which means you can drop it into an existing project without pulling in a large chain of other libraries. The entire compiler and virtual machine together add less than 200KB to an application on a 64-bit system, making it practical for situations where a full scripting environment would be too heavy. The language has a syntax that feels similar to Swift, with classes, methods, variables, and closures that most developers will find readable even if they have never used Gravity before. It is dynamically typed, so you do not have to declare what kind of value a variable holds. It also supports coroutines (called fibers), which are a way to pause a function partway through and resume it later, useful for cooperative multitasking without threads. Memory management is handled automatically through a mark-and-sweep garbage collector. Gravity was originally built for Creo, an app development tool that lets you build iOS and Android applications without deep native coding knowledge. Gravity is also the scripting layer for the Untold game engine. In both cases, the host application embeds Gravity and lets end users write scripts in it rather than writing C or platform-specific code directly. You can use Gravity as a standalone command-line tool to compile and run scripts, or you can build it as a shared library and call into it from your own C code using its embedding API. The README includes a short working example of compiling and executing a function that returns a value, which shows how the compiler and virtual machine steps connect. There is also built-in support for reading and writing JSON, an optional math module, and a file module. Building Gravity requires a C99-compatible compiler and works on Linux, macOS, BSD, and Windows through either Make or CMake.
← marcobambini on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.