On Apr 19, 2006, at 22:05, Peter Seibel wrote:

For the FAQ I need a simple diagram of a parse tree. Here's an ASCII
art sketch:

            *
          /   \
         /     \
        /       \
       +         -
     /   \     /   \
    1     2   3     4

If someone could make a reasonable looking .png of such a diagram,
maybe with circles for the nodes, that'd be a great help.

In the dot language of Graphviz, it could be stated like this:

digraph parsetree {
        node [shape = circle];
        edge [dir = none];

        star [label="*"];
        plus [label="+"];
        minus [label="-"];
        n1 [label="1"];
        n2 [label="2"];
        n3 [label="3"];
        n4 [label="4"];

        plus -> {n1 n2};
        minus -> {n3 n4};
        star -> {plus minus};
}


Which would look like the attached image:

PNG image


--
chr

_______________________________________________
Gardeners mailing list
[email protected]
http://www.lispniks.com/mailman/listinfo/gardeners

Reply via email to