{"id":13423483,"url":"https://github.com/marcobambini/gravity","last_synced_at":"2025-05-14T12:12:28.217Z","repository":{"id":40593417,"uuid":"83052165","full_name":"marcobambini/gravity","owner":"marcobambini","description":"Gravity Programming Language","archived":false,"fork":false,"pushed_at":"2024-07-08T17:47:57.000Z","size":2731,"stargazers_count":4369,"open_issues_count":45,"forks_count":236,"subscribers_count":112,"default_branch":"master","last_synced_at":"2025-04-09T03:11:18.092Z","etag":null,"topics":["bridge","bytecode","c","closure","fibers","gravity","interpreter","json","language","object-oriented","objective-c","portable","pratt-parser","programming-language","scripting-language","virtual-machine"],"latest_commit_sha":null,"homepage":"https://gravity-lang.org","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcobambini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-24T14:57:37.000Z","updated_at":"2025-04-07T16:37:09.000Z","dependencies_parsed_at":"2023-01-31T05:01:13.384Z","dependency_job_id":"44079af5-2d1d-4408-b286-1b69f9f47bd9","html_url":"https://github.com/marcobambini/gravity","commit_stats":{"total_commits":641,"total_committers":51,"mean_commits":"12.568627450980392","dds":"0.41965678627145087","last_synced_commit":"a31e74d5ddbe84d627a5db2cf6980035b97eccc2"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcobambini%2Fgravity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcobambini%2Fgravity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcobambini%2Fgravity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcobambini%2Fgravity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcobambini","download_url":"https://codeload.github.com/marcobambini/gravity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140768,"owners_count":22021220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bridge","bytecode","c","closure","fibers","gravity","interpreter","json","language","object-oriented","objective-c","portable","pratt-parser","programming-language","scripting-language","virtual-machine"],"created_at":"2024-07-31T00:00:35.677Z","updated_at":"2025-05-14T12:12:22.605Z","avatar_url":"https://github.com/marcobambini.png","language":"C","funding_links":[],"categories":["C","Embed-Script/VM/","Uncategorized","By Language","Scripts"],"sub_categories":["Lua","Uncategorized","C"],"readme":"[![Build Status](https://travis-ci.com/marcobambini/gravity.svg?branch=master)](https://travis-ci.com/marcobambini/gravity)\n\n\u003cp align=\"center\" \u003e\n\u003cimg src=\"https://raw.githubusercontent.com/marcobambini/gravity/master/docs/assets/images/logo-gravity.png\" height=\"74px\" alt=\"Gravity Programming Language\" title=\"Gravity Programming Language\"\u003e\n\u003c/p\u003e\n\n**Gravity** is a powerful, dynamically typed, lightweight, embeddable programming language written in C without any external dependencies (except for stdlib). It is a class-based concurrent scripting language with modern \u003ca href=\"https://github.com/apple/swift\"\u003eSwift\u003c/a\u003e-like syntax.\n\n**Gravity** supports procedural programming, object-oriented programming, functional programming, and data-driven programming. Thanks to special built-in methods, it can also be used as a prototype-based programming language.\n\n**Gravity** has been developed from scratch for the \u003ca href=\"http://creolabs.com\" target=\"_blank\"\u003eCreo\u003c/a\u003e project in order to offer an easy way to write portable code for the iOS and Android platforms. It is written in portable C code that can be compiled on any platform using a C99 compiler. The VM code is about 4K lines long, the multipass compiler code is about 7K lines and the shared code is about 3K lines long. The compiler and virtual machine combined add less than 200KB to the executable on a 64-bit system.\n\n## What Gravity code looks like\n\n```swift\nclass Vector {\n\t// instance variables\n\tvar x = 0;\n\tvar y = 0;\n\tvar z = 0;\n\n\t// constructor\n\tfunc init (a = 0, b = 0, c = 0) {\n\t\tx = a; y = b; z = c;\n\t}\n\n\t// instance method (built-in operator overriding)\n\tfunc + (v) {\n\t\tif (v is Int) return Vector(x+v, y+v, z+v);\n\t\telse if (v is Vector) return Vector(x+v.x, y+v.y, z+v.z);\n\t\treturn null;\n\t}\n\n\t// instance method (built-in String conversion overriding)\n\tfunc String() {\n\t        // string interpolation support\n\t\treturn \"[\\(x),\\(y),\\(z)]\";\n\t}\n}\n\nfunc main() {\n\t// initialize a new vector object\n\tvar v1 = Vector(1,2,3);\n\t\n\t// initialize a new vector object\n\tvar v2 = Vector(4,5,6);\n\t\n\t// call + function in the vector object\n\tvar v3 = v1 + v2;\n\t\n\t// returns string \"[1,2,3] + [4,5,6] = [5,7,9]\"\n    \treturn \"\\(v1) + \\(v2) = \\(v3)\";\n }\n ```\n\n## Features\n* multipass compiler\n* dynamic typing\n* classes and inheritance\n* higher-order functions and classes\n* lexical scoping\n* coroutines (via fibers)\n* nested classes\n* closures\n* garbage collection\n* operator overriding\n* powerful embedding API\n* built-in unit tests\n* built-in JSON serializer/deserializer\n* **optional semicolons**\n\n## Special thanks\nGravity was supported by a couple of open-source projects. The inspiration for closures comes from the elegant \u003ca href=\"http://www.lua.org\" target=\"_blank\"\u003eLua\u003c/a\u003e programming language; specifically from the document \u003ca href=\"http://www.cs.tufts.edu/~nr/cs257/archive/roberto-ierusalimschy/closures-draft.pdf\"\u003eClosures in Lua\u003c/a\u003e. For fibers, upvalues handling and some parts of the garbage collector, my gratitude goes to \u003ca href=\"http://journal.stuffwithstuff.com\" target=\"_blank\"\u003eBob Nystrom\u003c/a\u003e and his excellent \u003ca href=\"https://github.com/munificent/wren\"\u003eWren\u003c/a\u003e programming language. A very special thanks should also go to my friend **Andrea Donetti** who helped me debugging and testing various aspects of the language.\n\n## Documentation\nThe \u003ca href=\"https://marcobambini.github.io/gravity/#/README\"\u003eGetting Started\u003c/a\u003e page is a guide for downloading and compiling the language. There is also a more extensive \u003ca href=\"https://gravity-lang.org\"\u003elanguage documentation\u003c/a\u003e. Official [wiki](https://github.com/marcobambini/gravity/wiki) is used to collect related projects and tools.\n\n## Where Gravity is used\n* Gravity is the core language built into Creo (https://creolabs.com)\n* Gravity is the scripting language for the Untold game engine (https://youtu.be/OGrWq8jpK14?t=58)\n\n## Community\nSeems like a good idea to make a group chat for people to discuss Gravity.\u003cbr\u003e [![Join the chat at https://gitter.im/gravity-lang/](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gravity-lang/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n## Contributing\nContributions to Gravity are welcomed and encouraged!\u003cbr\u003e\nMore information is available in the official [CONTRIBUTING](CONTRIBUTING.md) file.\n* \u003ca href=\"https://github.com/marcobambini/gravity/issues/new\"\u003eOpen an issue\u003c/a\u003e:\n\t* if you need help\n\t* if you find a bug\n\t* if you have a feature request\n\t* to ask a general question\n* \u003ca href=\"https://github.com/marcobambini/gravity/pulls\"\u003eSubmit a pull request\u003c/a\u003e:\n\t* if you want to contribute\n\n## License\nGravity is available under the permissive MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcobambini%2Fgravity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcobambini%2Fgravity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcobambini%2Fgravity/lists"}