% A comment should be allowed anywhere

diagram_class("Trees and DRSs", "1.0")
dtd_name("treedrs.dtd")

diagram_spec(top, hbox([align(center),separator(space([height(0),width(20)]))],
	                [var(drs, [elements])]))



diagram_union(elements, [tree_top, value]) % like here for example

diagram_union(tree_top, [one_branch, two_branch, three_branch])

diagram_union(leaf_or_tree, [one_branch, two_branch, three_branch, lexical, referent, value])


diagram_union(category, [plain_category])

diagram_spec(plain_category, plain(var(cat, Text)))

diagram_union(value, [drs])

diagram_spec(lexical, italic(var(lex, Text)))


diagram_spec(drs,
	     box([padding(nothing())], 
		 vbox([align(left)],
		      [hbox([padding(space())],
	                    [var(universe, [referent])]),
% Comment out the following line to get K&R behaviour
		       line([expand]),
		       vbox([align(left), padding(space())],
	                    [var(conditions, [condition])])])))

diagram_spec(referent,
	     italic(var(id, Text)))

diagram_union(condition, [atomic, equation, implication, tree_top])

diagram_spec(equation,
	     hbox([],
		  [var(lhs, referent),
		   plain("="),
		   var(rhs, referent)]))

diagram_spec(implication,
	     hbox([align(centre)],
		  [var(lhs, drs),
		   plain(" -> "),
		   var(rhs, drs)]))

diagram_spec(atomic, 
	     hbox([separator(nothing())],
		  [var(relation, rel_symbol),
		   bracket([delimiter(round)],
			 hbox([separator(hbox([separator(nothing())],
					      [plain(","),
					       space([width(5),height(0)])]))],
			       [var(referents, [referent])]))]))

diagram_spec(rel_symbol, plain(var(symbol, Text)))

diagram_spec(one_branch, 
		tree([var(mother, category), var(daughter, leaf_or_tree)]))

diagram_spec(two_branch, 
		tree([var(mother, category), var(daughter_one, leaf_or_tree),
					     var(daughter_two, leaf_or_tree)]))

diagram_spec(three_branch, 
		tree([var(mother, category), var(daughter_one, leaf_or_tree),
					     var(daughter_two, leaf_or_tree),
					     var(daughter_three, leaf_or_tree)]))




start
