AST Inspector

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

AST Inspector

Mark Rizun
Hi, everyone!

When I was exploring AST in Pharo, at the beginning it seemed a bit confusing for me how the tree looks like, or which part of code some node represents etc. As I'm working with ASTs for a while now, still not an expert ;), I decided to make a simple AST Inspector for myself and everyone that needs it. Hopefully, this inspector will make peoples lives easier when learning ASTs. For now its very raw. Inspector shows the code and its AST representation visually like in the picture.
Also you can select/deselect a nodes of AST an see which part of code it represents (like in the picture above). Functionality ends here :) What do you think about it? Maybe you guys have some cool ideas for this inspector?



Cheers,
Mark
Reply | Threaded
Open this post in threaded view
|

Re: AST Inspector

Tudor Girba-2
Hi,

Did you already try the AST view from the GT Inspector?

Inline image 1

Cheers,
Doru



On Mon, Jun 29, 2015 at 6:04 PM, Mark Rizun <[hidden email]> wrote:
Hi, everyone!

When I was exploring AST in Pharo, at the beginning it seemed a bit
confusing for me how the tree looks like, or which part of code some node
represents etc. As I'm working with ASTs for a while now, still not an
expert ;), I decided to make a simple AST Inspector for myself and everyone
that needs it. Hopefully, this inspector will make peoples lives easier when
learning ASTs. For now its very raw. Inspector shows the code and its AST
representation visually like in the picture.
Also you can select/deselect a nodes of AST an see which part of code it
represents (like in the picture above). Functionality ends here :) What do
you think about it? Maybe you guys have some cool ideas for this inspector?

<http://forum.world.st/file/n4834638/AST_Inspector.png>

Cheers,
Mark




--
View this message in context: http://forum.world.st/AST-Inspector-tp4834638.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.




--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: AST Inspector

Thierry Goubier
In reply to this post by Mark Rizun
Hi Mark,

Le 29/06/2015 18:04, Mark Rizun a écrit :
> Hi, everyone!
>
> When I was exploring AST in Pharo, at the beginning it seemed a bit
> confusing for me how the tree looks like, or which part of code some node
> represents etc. As I'm working with ASTs for a while now, still not an
> expert ;), I decided to make a simple AST Inspector for myself and everyone
> that needs it. Hopefully, this inspector will make peoples lives easier when
> learning ASTs. For now its very raw. Inspector shows the code and its AST
> representation visually like in the picture.

Cool.

Need a bit of anti-aliasing for the round shapes :)

I wonder how it will look with a long method: they usually have rather
flat ASTs that would result in a wide diagram.

> Also you can select/deselect a nodes of AST an see which part of code it
> represents (like in the picture above). Functionality ends here :) What do
> you think about it? Maybe you guys have some cool ideas for this inspector?

I used that kind of inspector a lot for my work, but I usually just
represent the tree as a normal tree node morph (and with the exact
select the node => select the source).

Some of the added ones I use is showing the CFG (control flow graph),
eventually a SSA (Single Signed Assignment) or IR.

I tend to base them on the SmaCC AST API, so like that they work with
all programming languages, not only Smalltalk.

I tried to use GT-Inspector for that but it didn't work.

Thierry

> <http://forum.world.st/file/n4834638/AST_Inspector.png>
>
> Cheers,
> Mark
>
>
>
>
> --
> View this message in context: http://forum.world.st/AST-Inspector-tp4834638.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: AST Inspector

Mark Rizun
Need a bit of anti-aliasing for the round shapes :)

Right :)
 
I wonder how it will look with a long method: they usually have rather flat ASTs that would result in a wide diagram.

Yes it will be pretty huge. However, 1) there is an option to scale the tree (nodes) 2) most of the methods should not be very long ;)
Still the problem remains.

I built it rather for fun and my possible future work, than for wide usage. But I think it may be nice for some people to one-click and see the tree, and play with it.

About GT inspector: yes I've seen the ast view in inspecotr, and it's amazing how many things we can do with it.

Reply | Threaded
Open this post in threaded view
|

Re: AST Inspector

Peter Uhnak
What is it drawn with?

On Mon, Jun 29, 2015 at 6:53 PM, Mark Rizun <[hidden email]> wrote:
Need a bit of anti-aliasing for the round shapes :)

Right :)
 
I wonder how it will look with a long method: they usually have rather flat ASTs that would result in a wide diagram.

Yes it will be pretty huge. However, 1) there is an option to scale the tree (nodes) 2) most of the methods should not be very long ;)
Still the problem remains.

I built it rather for fun and my possible future work, than for wide usage. But I think it may be nice for some people to one-click and see the tree, and play with it.

About GT inspector: yes I've seen the ast view in inspecotr, and it's amazing how many things we can do with it.


Reply | Threaded
Open this post in threaded view
|

Re: AST Inspector

Mark Rizun
Simple morphic.

2015-06-29 20:01 GMT+03:00 Peter Uhnák <[hidden email]>:
What is it drawn with?

On Mon, Jun 29, 2015 at 6:53 PM, Mark Rizun <[hidden email]> wrote:
Need a bit of anti-aliasing for the round shapes :)

Right :)
 
I wonder how it will look with a long method: they usually have rather flat ASTs that would result in a wide diagram.

Yes it will be pretty huge. However, 1) there is an option to scale the tree (nodes) 2) most of the methods should not be very long ;)
Still the problem remains.

I built it rather for fun and my possible future work, than for wide usage. But I think it may be nice for some people to one-click and see the tree, and play with it.

About GT inspector: yes I've seen the ast view in inspecotr, and it's amazing how many things we can do with it.



Reply | Threaded
Open this post in threaded view
|

Re: AST Inspector

Tudor Girba-2
In reply to this post by Mark Rizun
Hi,

If you already seen the GT view, perhaps this means that you were missing something. Is it only the visual representation, or do you miss something else?

Also, you can embed your view directly in GT.

Cheers,
Doru



On Mon, Jun 29, 2015 at 6:53 PM, Mark Rizun <[hidden email]> wrote:
Need a bit of anti-aliasing for the round shapes :)

Right :)
 
I wonder how it will look with a long method: they usually have rather flat ASTs that would result in a wide diagram.

Yes it will be pretty huge. However, 1) there is an option to scale the tree (nodes) 2) most of the methods should not be very long ;)
Still the problem remains.

I built it rather for fun and my possible future work, than for wide usage. But I think it may be nice for some people to one-click and see the tree, and play with it.

About GT inspector: yes I've seen the ast view in inspecotr, and it's amazing how many things we can do with it.




--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: AST Inspector

Mark Rizun
If you already seen the GT view, perhaps this means that you were missing something. Is it only the visual representation, or do you miss something else?

For the most part the missing part is the visual representation of the tree. However I did this little inspector because in the future I (maybe) will implement a tool for code rewriting like Rewrite Tool, but only the rule creation process will be done by manipulating visual representation of the ASTs.
 
Also, you can embed your view directly in GT.

That's cool and I know - seen it at Pharo Days :)
Reply | Threaded
Open this post in threaded view
|

Re: AST Inspector

Tudor Girba-2
That's a nice project. A visual rule creation tool would be so cool!

Doru

On Mon, Jun 29, 2015 at 7:21 PM, Mark Rizun <[hidden email]> wrote:
If you already seen the GT view, perhaps this means that you were missing something. Is it only the visual representation, or do you miss something else?

For the most part the missing part is the visual representation of the tree. However I did this little inspector because in the future I (maybe) will implement a tool for code rewriting like Rewrite Tool, but only the rule creation process will be done by manipulating visual representation of the ASTs.
 
Also, you can embed your view directly in GT.

That's cool and I know - seen it at Pharo Days :)



--

"Every thing has its own flow"