graphical representation of a term

To get a nice picture of the term built, we can use:

expr e = Times( Plus( Const( 1 ), Const( 1 )), Plus( Const( 1 ), Const( 1 )) ); fdotprint_expr( stdout, e, "(1+1)*(1+1)", 0, 0, True, True, True );
(kimwitu has generated the fdotprint_expr routine from the input phylum definition)

and run dot (or run WebDot) on the output, which gives a result like the following: (edge numbers indicate a depth-first left-to-right treewalk):

[picture of a tree representation of (1+1)*(1+1) (without node sharing)]

If we put the above lines of C code in a main routine, and build an executable of it with name build_expr, then we can show the above tree with a Unix shell command line of:

$ build_expr | dot -Tps | ghostview -

next overview up

Last updated at 03 February '98 by