marcobambini/gravity
FreeGravity Programming Language
About marcobambini/gravity
Gravity is a powerful, dynamically typed, lightweight, and embeddable programming language written in portable C99 without any external dependencies (except for stdlib). It features a modern Swift-like syntax and supports procedural, object-oriented, functional, and data-driven programming paradigms. The language includes a multipass compiler with optimizer, dynamic typing, classes and inheritance, higher-order functions, lexical scoping, coroutines (via fibers), nested classes, closures, mark-and-sweep garbage collection, operator overriding, string interpolation, enums, modules, structs (value types), switch/case with ranges, optional modules (Math, File, JSON, ENV), and a powerful embedding API with bridging support. It also provides built-in unit tests and JSON serializer/deserializer. The compiler and virtual machine combined add less than 200 KB to the executable. Gravity was developed from scratch for the Creo project to provide an easy way to write portable code for iOS and Android platforms.
Key Features
Pros & Cons
- Lightweight and embeddable with minimal footprint (under 200KB)
- No external dependencies besides stdlib
- Supports multiple programming paradigms (procedural, OOP, functional, data-driven)
- Modern Swift-like syntax for readability
- Built-in coroutines (fibers) for concurrency
- Comprehensive built-in unit tests and JSON support
- Cross-platform (C99 compatible)
- Relatively niche with a smaller community and ecosystem
- Limited third-party libraries and tools
- Documentation primarily in the GitHub repository