The following example shows a typed syntax tree. This tree can either be drawn by the specialized algorithm for "downward laid-out trees" or by the normal algorithms. When the normal algorithms are used to draw a tree, it is advisable to increase the layout down factor in order to obtain good results (see Figure 22). If the layout down factor is not used, the incoming edges draw the nodes too much in the direction of the parent node.
A nice layout is achieved by the specialized tree algorithm with a tree factor of 0.9 (see Figure 23).
If an orthogonal layout is needed, the attribute smanhattan_edges can be used. For trees, this attribute is more appropriate than the standard Manhattan layout with manhattan_edges (see Figure 24).
Example 11: Syntax Tree
<>01 >graph: {
<>02 > title: "Typed Syntax Tree"
<>03 > node:
{ title:"503160" label: "Identifier\ntst3 (0)" }
<>04 > node:
{ title:"503240" label: "Identifier\nx (0)" }
<>05 > node:
{ title:"502952" label: "INTEGER" }
<>06 > node:
{ title:"503304" label: "VarDecl" }
<> > ...
<>29 > node:
{ title:"T0" label: "no type" }
<>30 > node:
{ title:"T1" label: "no type" }
<>31 > node:
{ title:"T2" label: "int" }
<> > ...
<>57 > edge: { source:"503304" target:"503240" }
<>58 > edge: { source:"503304" target:"502952" }
<> > ...
<>83 > nearedge: { source:"503160" target:"T0" linestyle: dotted }
<>84 > nearedge: { source:"503240" target:"T1" linestyle: dotted }
<>85 > nearedge: { source:"502952" target:"T2" linestyle: dotted }
<> > ...
<>110 >}
Next: Combination of Features
Up: Examples of GDL Specifications
Previous: The Effect of the
Last modified on 11 August 2003 by webmaster. © 2000-2003 AbsInt