This page is no longer maintained — Please continue to the home page at www.scala-lang.org

visual representation of ASTs, be they type or term?

7 replies
Miguel Garcia
Joined: 2009-06-10,
User offline. Last seen 42 years 45 weeks ago.

Besides the existing ways to explore trees (-Yshow-trees with -print:phase
for example), I'm looking for some utility method similar in spirit to

"-Xgenerate-phase-graph", "Generate the phase graphs (outputs .dot files)
to fileX.dot"

If you've been playing with that idea, feedback (prototype?) would be most
welcome.

Miguel
http://www.sts.tu-harburg.de/people/mi.garcia

Miguel Garcia
Joined: 2009-06-10,
User offline. Last seen 42 years 45 weeks ago.
Re: visual representation of ASTs, be they type or term?

I forgot to mention the motivational use case for my question:
AST visualization (as possible with -Ybrowse) helps to get started
but afterwards one would like to *navigate* the AST (without
resorting to heap walking :-) It would be great to know about
previous work on uses of the graph exchange format and tools
in a Scala setting, for example
http://www.gupro.de/GXL/tools/tools.html . Experience reports are welcome!

Miguel
http://www.sts.tu-harburg.de/people/mi.garcia

Adriaan Moors
Joined: 2009-04-03,
User offline. Last seen 42 years 45 weeks ago.
Re: visual representation of ASTs, be they type or term?
have you tried -Ybrowse?  val browse        = PhasesSetting     ("-Ybrowse", "Browse the abstract syntax tree after")
adriaan
On Thu, Dec 10, 2009 at 1:53 PM, Miguel Garcia <miguel.garcia@tuhh.de> wrote:

I forgot to mention the motivational use case for my question: AST visualization (as possible with -Ybrowse) helps to get started but afterwards one would like to *navigate* the AST (without resorting to heap walking :-) It would be great to know about previous work on uses of the graph exchange format and tools in a Scala setting, for example http://www.gupro.de/GXL/tools/tools.html . Experience reports are welcome!


Miguel
http://www.sts.tu-harburg.de/people/mi.garcia



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

Miguel Garcia
Joined: 2009-06-10,
User offline. Last seen 42 years 45 weeks ago.
Re: visual representation of ASTs, be they type or term?
  Do you mean the resulting window has a button "Generate GXL"?     Miguel http://www.sts.tu-harburg.de/people/mi.garcia  
----- Original Message ----- From: Adriaan Moors To: Miguel Garcia Cc: scala-internals@listes.epfl.ch Sent: Thursday, December 10, 2009 2:01 PM Subject: Re: [scala-internals] visual representation of ASTs, be they type or term?
have you tried -Ybrowse?    val browse        = PhasesSetting     ("-Ybrowse", "Browse the abstract syntax tree after")
adriaan
On Thu, Dec 10, 2009 at 1:53 PM, Miguel Garcia <miguel.garcia@tuhh.de> wrote:

I forgot to mention the motivational use case for my question: AST visualization (as possible with -Ybrowse) helps to get started but afterwards one would like to *navigate* the AST (without resorting to heap walking :-) It would be great to know about previous work on uses of the graph exchange format and tools in a Scala setting, for example http://www.gupro.de/GXL/tools/tools.html . Experience reports are welcome!


Miguel
http://www.sts.tu-harburg.de/people/mi.garcia



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

Adriaan Moors
Joined: 2009-04-03,
User offline. Last seen 42 years 45 weeks ago.
Re: visual representation of ASTs, be they type or term?
sorry, i missed the bit where you already mentioned Ybrowse. I guess I don't understand what you mean by "navigate" as it seems the ast browser supports navigation. Are you saying you'd like a converter from Scala Tree's to GXL? I don't think we have that, but it would definitely be cool
adriaan

On Thu, Dec 10, 2009 at 2:11 PM, Miguel Garcia <miguel.garcia@tuhh.de> wrote:
  Do you mean the resulting window has a button "Generate GXL"?     Miguel http://www.sts.tu-harburg.de/people/mi.garcia  
----- Original Message ----- From: Adriaan Moors To: Miguel Garcia Cc: scala-internals@listes.epfl.ch Sent: Thursday, December 10, 2009 2:01 PM Subject: Re: [scala-internals] visual representation of ASTs, be they type or term?
have you tried -Ybrowse?    val browse        = PhasesSetting     ("-Ybrowse", "Browse the abstract syntax tree after")
adriaan
On Thu, Dec 10, 2009 at 1:53 PM, Miguel Garcia <miguel.garcia@tuhh.de> wrote:

I forgot to mention the motivational use case for my question: AST visualization (as possible with -Ybrowse) helps to get started but afterwards one would like to *navigate* the AST (without resorting to heap walking :-) It would be great to know about previous work on uses of the graph exchange format and tools in a Scala setting, for example http://www.gupro.de/GXL/tools/tools.html . Experience reports are welcome!


Miguel
http://www.sts.tu-harburg.de/people/mi.garcia



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm for more information.

Miguel Garcia
Joined: 2009-06-10,
User offline. Last seen 42 years 45 weeks ago.
Re: visual representation of ASTs, be they type or term?
adriaan,   The navigation supported by the current-best approach (Ybrowse) seems too restrictive to me (up and down containment hierarchy only, as opposed to use-defs and others). I'll check what's available (say, to convert an arbitrary Java object graph into GXL) and possibly later come up with a design for Scala Trees. But only if nobody else goes for this challenge :-)     Miguel http://www.sts.tu-harburg.de/people/mi.garcia  
----- Original Message ----- From: Adriaan Moors To: Miguel Garcia Cc: scala-internals@listes.epfl.ch Sent: Thursday, December 10, 2009 2:01 PM Subject: Re: [scala-internals] visual representation of ASTs, be they type or term?
have you tried -Ybrowse?    val browse        = PhasesSetting     ("-Ybrowse", "Browse the abstract syntax tree after")
adriaan
On Thu, Dec 10, 2009 at 1:53 PM, Miguel Garcia <miguel.garcia@tuhh.de> wrote:

I forgot to mention the motivational use case for my question: AST visualization (as possible with -Ybrowse) helps to get started but afterwards one would like to *navigate* the AST (without resorting to heap walking :-) It would be great to know about previous work on uses of the graph exchange format and tools in a Scala setting, for example http://www.gupro.de/GXL/tools/tools.html . Experience reports are welcome!


Miguel
http://www.sts.tu-harburg.de/people/mi.garcia



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

Iulian Dragos 2
Joined: 2009-02-10,
User offline. Last seen 42 years 45 weeks ago.
Re: visual representation of ASTs, be they type or term?
I experimented with graphviz output for ASTs in a language much simpler than Scala, long ago. That was largely a failure and led me to write the Swing browser (ASTs are much too large for a static view). If GXL has better visualization tools than that it may be worth it, otherwise it's a waste of time.

The swing browser is really a hack, and can be improved in lots of ways. Navigation is one of them (though that's a much more ambitious project, since use-def links don't exist in the tree), another direction being navigation along symbols and types. It would be wonderful to have that ;-)

cheers,
iulian

On Thu, Dec 10, 2009 at 3:06 PM, Miguel Garcia <miguel.garcia@tuhh.de> wrote:
adriaan,   The navigation supported by the current-best approach (Ybrowse) seems too restrictive to me (up and down containment hierarchy only, as opposed to use-defs and others). I'll check what's available (say, to convert an arbitrary Java object graph into GXL) and possibly later come up with a design for Scala Trees. But only if nobody else goes for this challenge :-)     Miguel http://www.sts.tu-harburg.de/people/mi.garcia  
----- Original Message ----- From: Adriaan Moors To: Miguel Garcia Cc: scala-internals@listes.epfl.ch Sent: Thursday, December 10, 2009 2:01 PM Subject: Re: [scala-internals] visual representation of ASTs, be they type or term?
have you tried -Ybrowse?    val browse        = PhasesSetting     ("-Ybrowse", "Browse the abstract syntax tree after")
adriaan
On Thu, Dec 10, 2009 at 1:53 PM, Miguel Garcia <miguel.garcia@tuhh.de> wrote:

I forgot to mention the motivational use case for my question: AST visualization (as possible with -Ybrowse) helps to get started but afterwards one would like to *navigate* the AST (without resorting to heap walking :-) It would be great to know about previous work on uses of the graph exchange format and tools in a Scala setting, for example http://www.gupro.de/GXL/tools/tools.html . Experience reports are welcome!


Miguel
http://www.sts.tu-harburg.de/people/mi.garcia



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm




--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
Miguel Garcia
Joined: 2009-06-10,
User offline. Last seen 42 years 45 weeks ago.
Re: visual representation of ASTs, be they type or term?
  I hope to comment on the Swing browser in an upcoming write-up, as it sets the stage for extensions. Just to complete the list of options, in case someone is already familiar with the Scala X-Ray compiler plugin, I guess it could also be taken as starting point for generating (not surface-syntax but) graphs for consumption by GXL tools. Besides having access to all compilation units for the run, X-Ray already computes some derived information not already present as links ( types/applied implicits in tooltips, references/definition highlighted on mouseover , links to definition )   Come to think of it, a fusion of -Yshow-trees level of detail and X-Ray computed links would deliver great Figures for PhD reports :-)     Miguel http://www.sts.tu-harburg.de/people/mi.garcia    
----- Original Message ----- From: iulian [dot] dragos [at] epfl [dot] ch" href="mailto:iulian.dragos@epfl.ch" rel="nofollow">Iulian Dragos To: Miguel Garcia Cc: scala-internals@listes.epfl.ch Sent: Thursday, December 10, 2009 3:16 PM Subject: Re: [scala-internals] visual representation of ASTs, be they type or term?
I experimented with graphviz output for ASTs in a language much simpler than Scala, long ago. That was largely a failure and led me to write the Swing browser (ASTs are much too large for a static view). If GXL has better visualization tools than that it may be worth it, otherwise it's a waste of time.

The swing browser is really a hack, and can be improved in lots of ways. Navigation is one of them (though that's a much more ambitious project, since use-def links don't exist in the tree), another direction being navigation along symbols and types. It would be wonderful to have that ;-)

cheers,
iulian

On Thu, Dec 10, 2009 at 3:06 PM, Miguel Garcia <miguel.garcia@tuhh.de> wrote:
adriaan,   The navigation supported by the current-best approach (Ybrowse) seems too restrictive to me (up and down containment hierarchy only, as opposed to use-defs and others). I'll check what's available (say, to convert an arbitrary Java object graph into GXL) and possibly later come up with a design for Scala Trees. But only if nobody else goes for this challenge :-)     Miguel http://www.sts.tu-harburg.de/people/mi.garcia  
----- Original Message ----- From: Adriaan Moors To: Miguel Garcia Cc: scala-internals@listes.epfl.ch Sent: Thursday, December 10, 2009 2:01 PM Subject: Re: [scala-internals] visual representation of ASTs, be they type or term?
have you tried -Ybrowse?    val browse        = PhasesSetting     ("-Ybrowse", "Browse the abstract syntax tree after")
adriaan
On Thu, Dec 10, 2009 at 1:53 PM, Miguel Garcia <miguel.garcia@tuhh.de> wrote:

I forgot to mention the motivational use case for my question: AST visualization (as possible with -Ybrowse) helps to get started but afterwards one would like to *navigate* the AST (without resorting to heap walking :-) It would be great to know about previous work on uses of the graph exchange format and tools in a Scala setting, for example http://www.gupro.de/GXL/tools/tools.html . Experience reports are welcome!


Miguel
http://www.sts.tu-harburg.de/people/mi.garcia



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm




--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland