Giter Site home page Giter Site logo

ren's Introduction

[人] - REN - REadable Notation

Introduction

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

There are strings:

"hello world"

And there are words:

hello world   ; 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" [email protected] and so://on]	

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

REN[
    Title: "REN Example"
    Type: example
    Date: 5-4-2013
	Expires: never
    Version: 0.0.1
    Author: "Boleslav Brezovsky"
]

"hello world"
{
    hello multiline
    world
}
word
3.14
[a b c d]
info: [time is 2:45 and date is 2013-4-5]
person: object! [
    name: "Jaro"
    age: 1
    email: [email protected]
]

; this is comment

example: map! [
    "key1" "value1"
    "key2" http://value2.com
    "key3" [email protected]
]

See? It's simple.

Why?

It's much easier to 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"
      [email protected] ]

is same as

a: [1 "b" [email protected]]

Comment

Comments start with ;

; this is comment

String

There are two types of string. Single line and multi line. Single line string tarts 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.

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

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

Integer

64bit integer number

1
-23242

Floating point

Floating point number

3.14
1.2e34

Email

Standard email - see RFC5322

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

Header is optional but you are encouraged to use it. Unless you know what you are sending and where, you should add header as it enhances readability. Header can contain name, type, version, date, checksum and other useful informations about following data. Parse can for example just read header and decide if it makes sense to read rest of data (they may require higher version, data are expired etc.). Format of header is REN followed by block of key/value pairs. Header can be empty also.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.