[antlr-interest] tree walker executes method call twice?

Safiye Celik safisce at gmail.com
Thu Aug 20 01:58:42 PDT 2009


I have just realized I should download Graphviz to have dot executable in my
computer, right?

2009/8/20 Safiye Celik <safisce at gmail.com>

> Hi,
> Thanks for help, but I cannot execute "dot" command in eclipse. I get the
> error "exception: java.io.IOException: cannot run program "dot":
> CreateProcess" error=2, The system cannot find the file specified". When I
> try to execute the same command from the command line (after changing
> directory to the directory where .dot file exists), I get the error ""dot"
> is not recognized as an internal or external command, operable program or
> batch file". Where is the dot executable in the Windows system? Or is it a
> downloadable file? If so, where can I download it from?
>
> 2009/8/19 Jim Idle <jimi at temporal-wave.com>
>
> Safiye Celik wrote:
>> > Hi,
>> > How do you create DoubleWalk1.jpg tree? I wanna display my tree as
>> > yours which is more understandable for a human, but I cannot get such
>> > a tree. I use JTree component constructed from a DefaultTreeModel
>> > component, and the tree I get is as in the attachment, which is in
>> > expandable folder format and not readable enough. And I could not find
>> > any component in Java to display a tree as yours. I would be glad if
>> > you share your way. Thanks.
>> Search the past posting for how to generate a dot (www.graphviz.org)
>> specification from the AST and then run dot:
>>
>>  // Use the ANLTR built in dot generator
>>                    //
>>                    DOTTreeGenerator gen = new DOTTreeGenerator();
>>
>>                    // Which we can cause to generate the DOT specification
>>                    // with the input file name suffixed with .dot. You
>> can then use
>>                    // the graphviz tools or zgrviewer (Java) to view
>> the grahpical
>>                    // version of the dot file.
>>                    //
>>                    source = source.substring(0, source.length()-3);
>>                    String outputName = source + "dot";
>>
>>                    System.out.println("    Producing AST dot (graphviz)
>> file");
>>
>>                    // It produces a jguru string template.
>>                    //
>>                    StringTemplate st = gen.toDOT(t, new
>> CommonTreeAdaptor(), _treeST, _edgeST);
>>
>>                    // Create the output file and write the dot spec to it
>>                    //
>>                    FileWriter outputStream = new FileWriter(outputName);
>>                    outputStream.write(st.toString());
>>                    outputStream.close();
>>
>>                    // Invoke dot to generate a .png file
>>                    //
>>                    System.out.println("    Producing png graphic for
>> tree");
>>                    pStart = System.currentTimeMillis();
>>                    Process proc = Runtime.getRuntime().exec("dot -Tpng
>> -o" + source + "png " + outputName);
>>                    proc.waitFor();
>>                    stop = System.currentTimeMillis();
>>                    System.out.println("      PNG graphic produced in "
>> + (stop - pStart) + "ms.");
>>
>>
>> Jim
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>>
>
>
>
> --
> -safiye
>



-- 
-safiye
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090820/37f6d055/attachment.html 


More information about the antlr-interest mailing list