Thursday, June 28, 2012

CN - "C Data Notation"

Just for fun, here's an idea for a data notation that's sort of C-like in structure.  Does it have enough representational power to be useful?

CN  "C Data Notation"

A CN document is a list of items, separated by one or more newlines, like so:

list item one
list item two

list item three

---

CN documents are delimited by the triple-dash made popular by YAML:

---

Multi-line items use the C-style backslash \
at the end of the line.

---

Pairs are specified using the colon, like so:

key1: value1
key2: value2
key3: value3

Terminating colons do not represent a pair.

A group can be created using curly braces.

{
   key1: value1
   key2: value2
   key3: value3
   key4: value4\
         line2\
         line3\
         last line
        
}

It's not a hash, it's a key-value list, where the pairs are stored in order.

myLevel1:
{
   myLevel2:
   {
      subkey: 123
   }
}


A value from a pair can be referenced with an asterisk and the key's qualified namespace:

*myLevel1.myLevel2.subkey

No comments:

Post a Comment