Skip to content
/ REN Public
forked from humanistic/REN

The REN human friendly data notation

Notifications You must be signed in to change notification settings

r3n/REN

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 

Repository files navigation

[人] - REN - REadable Notation

Introduction

REN is simple yet powerful data storage, exchange and notation format. It's very human friendly and pleasant to read. Every value in REN has its own type to allow easier description of your data. See for yourself.

There are strings:

"hello world"

And there are words:

hello world

Numbers are also supported in integer and floating point form.

1
-1
3.14
-2.354e3

Another type will tell you where to get help:

http://server.com/readme

You get the idea.

The basic form of data collection in REN is block.

[1 "a" e@ma.il and so://on]	

You can also add header to data transmission to inform the loader about type of data.

REN[
	name: Ren
	occupation: "Data language"
	purpose: {
		Easily share data between people and machines.
		Keep the rules simple.
		Be useful.
	}
	version: 0.0.1
	created: 5-Apr-2013
	modified: 13:59:01
	started: 5-Apr-2013/13:59+2:00
	expires: never
]

home: https://github.com/humanistic/REN
email: info@ren-lang.org
complete?: no
comments-start-with: #";"
primary-delmiters: [#" " #"^-" #"^/"] ; space tab newline

test: (1 + 1)
starting-file: %readme.txt
off-the-beaten: 'a/b/c
axis: /x
bin-hex-val: #{48656C6C6F20776F726C6421}
bin-base-64-val: 64#{SGVsbG8gd29ybGQh}

number-of-supporters: 300
avg-IQ: 147.35
cost-to-use: $0.00
happy-users: 98.6%

common-hashtag: #ren
screen-size: 1920x1080
favorite-tag: <bold>
;favorite-color: 92.128.164
;lives-at: 127.0.0.1	

object! [
	a: 1
	b: "test"
]

map! [
	"key 1" 1
	"key 2" "test"
]
dataypes: [
	word! string! tuple! date! time! url! email! logic! 
	block! char! paren! file! path! refinement! binary!
	integer! decimal! money! percent! issue! pair! tag!
	object! map!
]

See? It's simple.

###Why?

It's much easier on the eyes than XML and JSON and at the same time it's at least as powerful. Broader datatype support is also great property of REN.

##Syntax

###Whitespaces

Whitespaces are space, tab and newline. They work as delimiters. There's no comma anywhere. You can put as many whitespaces as you want anywhere you want.

a:
[      1
"b"
      c@d.e ]

is same as

a: [1 "b" c@d.e]

####Why no comma?

The question is, why comma?

  • Space doesn't visually bother as comma.

  • Space key is easier to hit than comma.

  • Having (white)space as delimiter allows simple creaton of DSLs or dialects.

See this example:

send someone@somewhere.com "Something"

In languages with poor datatype support this could be interpreted as:

{"send","someone@somewhere.com","Something" };

However languages with richer datatype support may understand this as for example Remote Procedure Call (RPC):

sendEmail("someone@somewhere.com","Something");

Just use it as you want to. It's simpler way to express itself.

###Comment

Comments start with ;

; this is comment

###String

There are two types of string. Single line and multi line. Single line string starts and ends with quotes. Multiline string starts with { and ends with }. String is UTF-8 encoded. Special characters are escaped with ^ (see table below)

"single line"

{multi
line}
Character Definition
^" Inserts a double quote (").
^} Inserts a closing brace (}).
^^ Inserts a caret (^).
^/ Starts a new line.
^(line) Starts a new line.
^- Inserts a tab.
^(tab) Inserts a tab.
^(page) Starts a new page.
^(back) Erases one character to the left of the insertion point.
^(null) Inserts a null character.
^(escape) Inserts an escape character.
^(letter) Inserts control-letter (A-Z).
^(xxxx) Inserts an Unicode character by hexidecimal (xxxx) number.

###None

NONE is value that loader should convert to apropriate value in target language, for example NULL.

NONE

###Boolean (logic)

There are six boolean values. Why not just two? Because TRUE and FALSE are not enough. Sometimes it's better to use YES or NO or ON and OFF.

TRUE
NO
ON

###Integer

64bit integer number

1
-23242

Parser rules:

numbers: [#"0" - #"9"]
exponent: [#"e" | #"E"]
minus: #"-"
integer: [opt minus some numbers opt [exponent opt minus some numbers]]

###Floating point

Floating point number

3.14
1.2e34

Parser rules:

dot: #"."
float: [opt minus some numbers dot integer]

###Word

Word contains alphanumerical characters, numbers and any of following characters:

? ! . ' + - * & | = _

Word cannot start with number. Words are used to construct domain specific languages (DSL) or dialects. More on DSL/dialects later.

word after word

Some syntax is reserved for future but not currently implemeted:

'world        ; key reference with "'"
hello :world  ; hello and get 'world key value
hello: world  ; set hello to 'world
hello: :world ; set hello to 'world key value

Parser rules:

letters: [#"a" - #"z" #"A" - #"Z"]
specials: [#"?" #"!" #"." #"'" #"+" #"-" #"*" #"&" #"|" #"=" #"_"]
characters: [some [letters | numbers | specials]]

###Key (set-word)

Key (also set-word) is used to indicate that word should get following value. Format of set-word is word followed by colon.

a: 1
name: "Pepa"
color: #FF00FF

###Email

Standard email - see RFC5322

test@example.com

###URI

Standard URI - see RFC3986

http://www.example.com

###Date and time

Date and time as defined in RFC3339 You can use slash instead of T, so it's more human readable.

12:45
14-3-2013
1-1-2000/13:20
1937-01-01T12:00:27.87+00:20

###Block

[ "this" is: block ]

###Object

Object is collection of set-words (keys) and values kept together in block and prefixed with object! word.

###Map

Map is similiar to object but can have strings as keys.

##Structure

###Header

The header is optional but you are encouraged to use it. Unless you know what you are sending and where, you should include a header as it enhances readability. The header can contain name, type, version, date, checksum and other useful information about the data that follows. Parsers can then, for example, just read the header and decide if it makes sense to read the rest of the data. It may require version handling, deal with expired data etc. The header format is REN followed by a block of key/value pairs. The header can also be empty.

About

The REN human friendly data notation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published