Thursday, October 13, 2011

YSON is a Structured Object Notation

Here's my proposed structure.  I want to keep the quotes to a minimum.

records:
[
    !record record:
    {
      !game &001 game:
      {
        date: 'March 2, 1962',
        versus: New York
      },
      notes: Awesome!,
      number: 100,
      !player &002 player:
      {
        name: Wilt Chamberlain,
        team: Philadelphia
      },
      record: Most points single game
    },
    
    !record record:
    {
        game: *001,
        number: 59,
        player: *002,
        record: 'Most points, one half'
    }
]


object
    hash

hash
    {}
    { pairs }

pairs
    key: value
    key: value, ...

key:
    string
    &id string
    !type string
    !type &id string
    
list
    []
    [ elements ]

elements
    value
    value, elements

value
    key
    string
    number
    object
    hash
    list
    true
    false
    null

Toward a common script grammar

It seems like scripting languages are slowly converging on a small number of common grammars and one structural data representation.


Common Grammars

The two common grammars are (1) simplified C and (2) Smalltalk.

More to the point, the simplification of C includes removing those pesky parentheses in control flow expressions.  I see them dropping everywhere, which I think is probably a good thing.

Anyway, it seems reasonable that most scripting languages' identities are bound by their feature sets and runtime details, rather than their basic grammar, and therefore it's only beneficial that they should converge.  Naturally it won't happen, but it would be nice.  

Alternately, it seems like an ideal scripting language would be able to understand many variants of C grammar, if only because the grammars are so closely related and are, essentially, representing solved problems Solved problems should not have variant grammars.


Common Structure

The structural data rep has little variations, but is essentially curly brackets to hold key-value pairs, a pair operator, and square braces to handle lists.  The data model is more powerful than JSON, and less powerful than YAML, but otherwise looks like them.  Call it JSON with references, or a strict, sane subset of YAML of scalars, lists, hashes, and references.  YSON, perhaps.

Seems that an ideal scripting language would therefore allow the user to specify the pair operator, key decoration, and value decoration.  Should take care of the major players.
 

Monday, October 3, 2011

Deneb sourcebook

...is crawling along, sometimes painfully slowly. But I'm still on schedule, thanks to giving myself lots and lots of time.  I'm currently working on "Fleets" - how duchies and smaller states in the sector squabble with each other by tradewar and skirmishings, and how they do it without provoking an Imperial response.