Visualizing nsc

Here’s quick screenshot of nsc’s internal compilation trees, as yielded by a tree browser using prefuse (a visualization toolkit). With some polish this can become a very interesting way to look at (and understand better) what the Scala compiler is doing. The prefuse toolkit has a “TreeView” example that demonstrates a good way to handle large trees. This is a view of a compilation tree of 3807 nodes.


Compiler Trees

Alternatively, one can use the obscure compiler option -Ybrowse:<phase> to fire a Swing interface which shows trees, symbols and types (and allows navigation). To know the valid phases, type scalac -Xshow-phases. A good time to look at the trees is after type-checking: scalac -Ybrowse:typer <source>

 
language/nsc-visualization.txt · Last modified: 2008/02/08 12:24 by dragos
 
Recent changes RSS feed Valid XHTML 1.0 Driven by DokuWiki