[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
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.
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)
HTH,
AvK
_______________________________________________
computer-go mailing list
computer-go@xxxxxxxxxxxxxxxxx
http://www.computer-go.org/mailman/listinfo/computer-go/