I am not sure to what syntax visualization is useful for, but indeed, this is easy in RoassalAssuming a class MyVisitor, that simples collect the nodes of the AST.-=-=-=-=-=-=-=-=-=-=| ast visitor g |
"We get the nodes from the AST"
ast := RBParser parseMethod: (ArrayTest>>#testReplaceFromToWithStartingAt) getSource.
visitor := MyVisitor new.
ast acceptVisitor: visitor.
"Visualization"
g := RTGraphBuilder new.
g node�
if: #isMessage shape: (RTEllipse new size: 10; color: Color red ) + (RTLabel new text: #selector);
if: #isReturn shape: (RTEllipse new size: 10; color: Color red );
if: #isBlock shape: (RTBox new size: 10; color: Color blue );
shape: (RTEllipse new size: 10; color: Color gray ).
g layout use: RTTreeLayout new.
g edge connectTo: #parent.
g addAll: visitor nodes.
g applyLayout.
g view
-=-=-=-=-=-=-=-=-=-=Cheers,Alexandre
On Apr 4, 2014, at 4:34 AM, Goubier Thierry <thierry.goubier@cea.fr> wrote:
It seems that Microsoft has opened interesting parts of the C# compilation infrastructure, including syntax visualisation.
http://roslyn.codeplex.com/wikipage?title=Syntax%20Visualizer&referringTitle=Home
Ideas for Opal+Roassal2 ?
Thierry
--�
Thierry Goubier
CEA list
Laboratoire des Fondations des Syst�mes Temps R�el Embarqu�s
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95
--�
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel �http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.