Lightweight embeddable dynamic language with concurrency.

Gravity is a powerful, dynamically typed, lightweight, embeddable programming language written in C without any external dependency (except stdlib). It is a class based concurrent scripting language with a modern Swift like syntax.

Gravity supports procedural programming, object-oriented programming, functional programming and data-driven programming. Thanks to built-in special methods it can also be used as a prototype-based programming language.

Features

  • multipass compiler
  • dynamic typing
  • classes and inheritance
  • higher order functions and classes
  • lexical scoping
  • coroutines (via fibers)
  • nested classes
  • closures
  • garbage collection
  • operator overriding
  • powerful embedding api
  • built-in unit tests
  • built-in JSON serializer/deserializer
class Rectangle {
	// instance variables
	var width;
	var height;
				
	// instance method
	func area() {
		return width*height;
	}
				
	// constructor
	func init(w, h) {
		width = w;
		height = h;
	}
}			

func main() {
	// initialize a new Rectangle object
	var r = Rectangle(20, 10);
			
	// return value is 20*10 = 200
	return r.area();
}
Information updated 03/07/17
View Comments