Browse Source

Update README.md

Marco Bambini 8 years ago
parent
commit
e8136ea1c0
1 changed files with 19 additions and 7 deletions
  1. 19 7
      README.md

+ 19 - 7
README.md

@@ -4,16 +4,18 @@
 
 **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 <a href="https://github.com/apple/swift">Swift</a> like syntax.
 
-**Gravity** supports procedural programming, object-oriented programming, functional programming and data-driven programming. Thanks to built-in bind methods it can also be used as a prototype-based programming language.
+**Gravity** supports procedural programming, object-oriented programming, functional programming and data-driven programming. Thanks to built-in bind method it can also be used as a prototype-based programming language.
 
-## Example
+## How Gravity code looks like
 
 ```swift
 class Vector {
+	// instance variables
 	var x=0;
 	var y=0;
 	var z=0;
 	
+	// constructor
 	func init (a, b, c) {
 		if (!a) a = 0;
 		if (!b) b = 0;
@@ -21,26 +23,33 @@ class Vector {
 		x = a; y = b; z = c;
 	}
 	
+	// instance method (built-in operator overriding)
 	func + (v) {
 		if (v isa Int) return Vector(x+v, y+v, z+v);
 		else if (v isa Vector) return Vector(x+v.x, y+v.y, z+v.z);
 		return null;
 	}
-  
+  	
+	// instance method (built-in String conversion overriding)
 	func String() {
 		return "[" + x.String() + "," + y.String() + "," + z.String() + "]";
 	}
 }
 
 func main() {
-  var v1 = Vector(1,2,3);
-  var v2 = Vector(4,5,6);
-  var v3 = v1 + v2;
-  return v3.String();
+	// initialize a new vector object
+	var v1 = Vector(1,2,3);
+	// initialize a new vector object
+	var v2 = Vector(4,5,6);
+	// call + function in the vector object
+	var v3 = v1 + v2;
+	// returns string "[5,7,9]"
+	return v3.String();
  }
  ```
 
 ## Features
+* multipass compiler
 * dynamic typing
 * classes and inheritance
 * higher order functions and classes
@@ -53,6 +62,9 @@ func main() {
 * built-in unit test
 * built-in JSON serializer/deserializer
 
+## Credits
+**Gravity** has been developed from scratch for the <a href="http://creolabs.com" target="_blank">Creo</a> project in order to offer an easy way to write portable code for the iOS and Android platforms. For closures implementation inspirations come from the excellent <a href="http://www.lua.org" target="_blank">Lua</a> programming language. For fibers and some portions of the garbage collector my gratitude should come to <a href="http://journal.stuffwithstuff.com" target="_blank">Bob Nystrom</a> and his excellent <a href="https://github.com/munificent/wren">Wren</a> programming language.
+
 ## Documentation
 
 ## Author