data Document = RootDoc root:Root data Root = Root graph:Graph caption:String label:String probtables:[Probtable] title:String sections:[Section] data Section = Section title:String paragraphs:[Paragraph] subsections:[Subsection] data Subsection = Subsection title:String paragraphs:[Paragraph] subsubsections:[Subsubsection] data Subsubsection = Subsubsection title:String paragraphs:[Paragraph] data Paragraph = Paragraph words:[Word] | SubgraphPara subgraph:Subgraph caption:String label:String | ProbtablePara probtable:Probtable data Word = Word word:String { idp : IDP } | NodeRef nodeName:NodeName | Label label:String | LabelRef label:String data NodeName = NodeName name:String -- extra indirection, so NodeName can have structural pres, while name is parsing -- for the caption in SubgraphPara we do it the dirty way. data Graph = Graph dirty:Dirty vertices:[Vertex] edges:[Edge] data Vertex = Vertex name:String shape:Shape id:Int x:Int y:Int data Shape = Circle | Square data Edge = Edge from:Int to:Int data Subgraph = Subgraph dirty:Dirty vertices:[Vertex] edges:[Edge] data Dirty = Dirty | Clean data Probtable = Probtable id:Int values:[Value] table:Table data Value = Value val:String data Table = Table parents:[Int] axes:[Axis] probs:[Probability] data Axis = Axis [Value] data Probability = Probability prob:String