[RFC] Graph Text

Graph Text or GT is a data exchange format with graphs.

GT is JSON in spirit and XML in functionality.

{
	key'value'
	isMorning+1
	x+120
	'y'300
	'[complex]{key}'simpleval
	'''object\'s an object'
	object{
		d[ M150 0 L75 200 L225 200 Z ]
	}
	''[ this is a multiline comment, the following
	creates a node with attributes instead of object]
	{node id'd9b4c7b7' 'random'-224.44e-12 '''inline comment' [
		'''attributes end, and first child begins'
		{framework:function
			framework:cmd'dostrer'
			framework:text'@string/function_text'
		}
	]}
	{table title'Hitchhiker\'s Guide to the Galaxy' {
		[author { name } [
			'Douglas Adams'
			'Some Other Guy'
		]]
		characters[character { name age } [
			'Zaphod Beeblerox' 100
			'Arthur Dent' 42
			'Ford Perfect' 182
		]]
	}}
}

Specification

A whitespace is space, linefeed, carriage return or horizontal tab.

Value types are,

A object-node starts {left brace + a string

A number is any base 10 representation of a number. Base 10 exponent can be appended. smaller case e should be always used for representing exponenets instead of E.

A string is a sequence of zero or more bytes, wrapped in single quotes and a string is a word that is not a number, or the symbols {, [, ], } . A 'quote can be represented with \' and a \solidus is represented with \\. A character is represented as a single byte string.

When a number evaluation fails, it should be treated as a string.

An object is an unordered set of name/value. An object begins with {left brace and ends with }right brace. Each name is followed by a value indicator which is

name can be anything except whitespace or value indicators and name/value pairs are separated by whitespace

An array is an ordered collection of values. An array like an object, begins with [left square bracket and ends with ]right square bracket. Values are separated by whitespace

A complex has associated properties for the key. A complex can be thought of as an attributre in XML.

Links