[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [computer-go] SGF parsers




> -----Original Message-----
> From: computer-go-bounces@xxxxxxxxxxxxxxxxx
> [mailto:computer-go-bounces@xxxxxxxxxxxxxxxxx]On Behalf Of A van Kessel
> Sent: Tuesday, December 14, 2004 8:14
> To: computer-go@xxxxxxxxxxxxxxxxx
> Subject: RE: [computer-go] SGF parsers
>
>
> Mark Boon wrote:
> >  DOM-tree I'd want the move-node to be parent of the comment-node that
> > belongs to it. Same for markup. But in the SGF file they can appear all
>
> Beware of confusion here! SGF uses the (very common) word "node"
> for a different concept as "node in a tree"
>
> An sgf-node *has* properties.
> *within* a an sgf-node, properties are unique (do not repeat)
>
> So, basically an SGF-node can be seen as a bag of name=value pairs.
> There a some nasty semantics, and typing involved, but these
> can be mostly ignored for well-formed input.

I did read somewhere the properties had to be unique... But it's not a
simple name=value pair as a property has a list of values, like in
AW[aa][ab][ba]

> For the parser, the only tricky part is to distinguish
> subtrees<->variations-
> within a subtree. This happens when you see a '(', and you have to decise
> how to juggle/massage the parsetree.
> The nice thing with SGF is you can safely ignore anything you
> don't want :-)
>
> NB I don't know how DOM trees handle "repeating" groups (eg variations)
> (XML does handle them, but I'm not sure about order)

A DOM-tree is a simple tree with named nodes. Nodes have a collection of
name/value pairs, called attributes. Variations just means a node has more
than one move-node as a child. Basically.

I just realise now how impractical that would be in relation to XML though.
If the next move is a child of the current move, then the XML is going to
have the closing tag of this move after the closing tag of the next move. So
a 300 move sequence would end in 300 </move> closing tags. So I'll have to
think of something else...

_______________________________________________
computer-go mailing list
computer-go@xxxxxxxxxxxxxxxxx
http://www.computer-go.org/mailman/listinfo/computer-go/