Types, byte codes etc.

Oren Ben-Kiki <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <1178396422.19567.179.camel@nero>
Ingy, Xitology and I had a chat on the IRC channel. Here is what we got
so far:

- We seem to have a consensus on the notion of JSON-compatible basic
types, with the caveat that we can superset JSON a bit (e.g., allow '~'
for null, use '<<', etc.)

- By default implementation should assume the basic set of types, unless
there's some indication otherwise (!tag, command line flags, parser
config, etc.)

- There's some debate on the exact set of types (e.g. number vs.
int/float). We need to discuss and finalize this.

- Once we have a "basic" set of types we need to move it into the spec
itself, to distinguish it from the wide range of cross-platform
additional types one may use.

We also discussed the concept of byte code representation for YAML. We
had a thread about this in Sep 2003 which went in the direction of a
specialized line-oriented format. However, Xitology has sold us on the
notion of using the "canonical" format as a byte code.

The idea is to start with JSON, insist that every token will be on its
own line, and throw in the minimal number of features required to
present anything YAML supports (that is: tags, anchors and aliases,
directives, and '...'). The result would look something like:


    {
    "foo"
    }
    ...
    {
    !bar
    "baz"
    }

On the one hand, this is a line-oriented format that is trivial to
process without the need for a "parser", using the 1st character as a
"code". It can be viewed as a stream of events, and is a good basis for
a streaming SAX-like API.

On the other hand, this is also a valid YAML stream that can be fed
as-in into any YAML system. Even better, as long as one sticks with the
JSON subset, the result is a valid JSON document!

This unifies several issues into a single solution:
(1) The canonical presentation of YAML documents
(2) Byte code presentation of YAML documents for use "without a parser"
for regression tests etc.
(3) A standard events API for streaming YAML parsers
(4) "YSON" - the minimal extension to JSON required to present all
YAML_supported data structures.

Very neat!

Have fun,

	Oren Ben-Kiki


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.