Xaint 1.0.5 Specification


Overview

Xaint is a text data format with the goal of being easy to read by humans and parse by machines. It adopts some similar attributes from text lanugages such as the XML and INI file format.


Goals

1. To be easy for developers to write a parser for.
2. To be easy for users to edit by hand.
3. To not be overly strict, and to not rely on well-formness.
4. To always maintain Unicode under one encoding type, UTF-8.


Non-Goals

1. To be a markup language. (There are plenty of these out there.)
2. External resources. (Xaint will not use an include style directive natively.)
3. Support multiple encoding types.


Document Structure

[1]  document ::= element*
[2]  element  ::= ws* | name* | string* | comment* | pragma* | slist* | elist*
[3]  ws       ::= (#x20 | #xA | #xD | #xC | #x9 | #xB)+
[4]  char     ::= [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
[5]  name     ::= '[' char* ']'
[6]  string   ::= '"' char* '"'
[7]  comment  ::= '*' char* '*'
[8]  pragma   ::= '?' char* '?'
[9]  slist    ::= '('
[10] elist    ::= ')'


Element List

NAME:      [BOOK]
STRING:    "The Plug-In Drug"
COMMENT:   *I am addicted*
PRAGMA:    ?If you can, do something about it?
SLIST:     (
ELIST:     )
WS:


Escape Characters

Each element has only one escape character (except ws, slist, ad elist)

NAME:       ]  =  ]]
STRING:     "  =  ""
COMMENT:    *  =  **
PRAGMA:     ?  =  ??


Examples

A Configuration File

This example shows that one can use lists as arrays of values. It also shows that it can have any number of elements at the root level.

[Colors] ("Blue" "Red" "Green" "Violet" "Brown")
[Fonts] ("Frutiger" "Garamond" "Helvetica" "Verdana")

[UI Style]
(
	[Background Color] "Blue"
	[Font] "Frutiger" 
	[Font Color] "Black"
)
[UI Actions]
(
	[Button Press] "Button Action"
	[Key Press] "Key Action"
)

A Text Message

[note]
( 
   [to] "Tove"
   [from] "Jani" 
   [heading] "Reminder"
   [body] "Don't forget me this weekend!"
)

A Breakfast Menu

[breakfast-menu]
(
  [food]
  (
    [name] "Belgian Waffles"
    [price] "$5.95"
    [description] "two of our famous Belgian Waffles with plenty of real maple syrup"
    [calories] "650"
  )
  [food]
  (
    [name] "Homestyle Breakfast"
    [price] "$6.95"
    [description] "two eggs, bacon or sausage, toast, and our ever-popular hash browns"
    [calories] "950"
  )
)

A Slideshow

*  A SAMPLE set of slides  *

[slideshow]
(
   [title] "Sample Slide Show"	
   [date] "Date of publication"	
   [author] "Yours Truly"	
	
   * TITLE SLIDE *
   [slide]
   (
     [type] "all"
     [title] "Wake up to WonderWidgets!"	
   )
	
   * OVERVIEW *	
   [slide] 
   (
     [type] "all"
     [title] "Overview"
     [item] ("Why " [em]"WonderWidgets" " are great")
     [item] ()
     [item] ("Who " [em]"buys" " WonderWidgets")
   )
)

Etc...

"
This is a example of an xaint file's not-strict nature.
	""String inside a string""
"


("This value belongs to an anonymous list and name element" "Me too")

[  My Root Element (I can contain all sorts of characters, UNICODE included)! ]
(
	"The parent of this value does not need a closing list token, nor 
	does this string because it is at the end of the file