Gravity is a dynamically typed, embeddable programming language written in C that combines Swift-like syntax with support for procedural, object-oriented, functional, and data-driven programming paradigms.
Gravity addresses the need for a lightweight scripting language that can be embedded in host applications without external dependencies. It was developed specifically to enable portable code across iOS and Android platforms. The language implements a multipass compiler with optimization, a bytecode virtual machine with mark-and-sweep garbage collection, and a comprehensive embedding API that allows bridging between Gravity code and host applications. The entire implementation is compact, with the VM at approximately 6.5K lines, the compiler at roughly 10K lines, and combined overhead under 200KB on 64-bit systems.
Gravity suits projects requiring an embeddable scripting layer with modern language features. It is particularly valuable for applications targeting multiple platforms where code portability matters. The language supports closures, coroutines via fibers, nested classes, operator overloading, and optional modules for Math, File, JSON, and environment access. Developers should note that Gravity requires only a C99 compiler and has no external dependencies, making it straightforward to integrate into existing C or C++ codebases. The tool includes built-in unit testing support and JSON serialization capabilities.
The project maintains comprehensive documentation including an architecture guide and embedding examples. Development activity shows attention to robustness through dedicated fuzzing inputs and tests designed to catch infinite loops. The codebase is organized with clear separation between compiler, runtime, and shared components, supported by detailed API documentation in the header files.