Skip to main content



      Home
Home » Modeling » TMF (Xtext) » How to get AST from plugin project
icon5.gif  How to get AST from plugin project [message #760041] Wed, 30 November 2011 23:55 Go to next message
Eclipse UserFriend
Ok, so what I'm trying to do is create an eclipse plugin that displays a graph of part of a language's AST.

I've been looking, but the closest thing I can find is the org.eclipse.emf.transaction.listeners extension point, but I'm not sure if this will work, given that none of the projects extend the org.eclipse.emf.transaction.editingDomains extension point, at least as far as I can see.

Is there an extension point that I can extend, or something that I can add to the xtext generator which will let me get at this?

[Updated on: Thu, 01 December 2011 18:46] by Moderator

Re: How to get AST from plugin project [message #760338 is a reply to message #760041] Thu, 01 December 2011 18:45 Go to previous messageGo to next message
Eclipse UserFriend
So, I'm still stuck on this.
Every time a project is built from my DSL, it generates java code from an AST.
All I'm looking for is to hook into the AST at that point. How do I do this?
Re: How to get AST from plugin project [message #760354 is a reply to message #760338] Fri, 02 December 2011 01:06 Go to previous messageGo to next message
Eclipse UserFriend
On 01/12/2011 23:45, Jeff wrote:
> So, I'm still stuck on this.
> Every time a project is built from my DSL, it generates java code from
> an AST.
> All I'm looking for is to hook into the AST at that point. How do I do
> this?
Look for the *.ecore file; it is a (meta-)model

Regards

Ed Willink
Re: How to get AST from plugin project [message #760478 is a reply to message #760338] Fri, 02 December 2011 09:04 Go to previous messageGo to next message
Eclipse UserFriend
Not sure I understand your question.

Your DSL (x) is expressed in a grammar x.xtext.
Xtext generates (among other things) an ecore model (x.ecore).
EMF then generates Java code - an implementation of this model.

Later an instance of your language x.dsl is parsed by the generated
parser and an instance of the ecore.model is created.
At this point, you may have a builder that generates Java code for this
model (i.e. x.java).

What exactly is it you want to process? The x.ecore, or the model of an
x.dsl ?

Regards
- henrik

On 2011-02-12 24:45, Jeff wrote:
> So, I'm still stuck on this.
> Every time a project is built from my DSL, it generates java code from
> an AST.
> All I'm looking for is to hook into the AST at that point. How do I do
> this?
Re: How to get AST from plugin project [message #760725 is a reply to message #760478] Sun, 04 December 2011 15:58 Go to previous messageGo to next message
Eclipse UserFriend
The model of an x.dsl.
I think I may have figured out a way of doing it, but I'm not sure if it's right - I'll have a shot at it, but any tips are appreciated.
Re: How to get AST from plugin project [message #760811 is a reply to message #760725] Mon, 05 December 2011 05:46 Go to previous messageGo to next message
Eclipse UserFriend
You could have a look at: https://github.com/dslmeinte/EMF-Statistics-View (fork)
Also, "Visualizing the AST" in http://dslmeinte.wordpress.com/2010/09/06/tricks-for-implementing-scoping/ explains how to do this manually in Eclipse.
Re: How to get AST from plugin project [message #760813 is a reply to message #760725] Mon, 05 December 2011 05:47 Go to previous messageGo to next message
Eclipse UserFriend
On 2011-04-12 21:58, Jeff wrote:
> The model of an x.dsl.
> I think I may have figured out a way of doing it, but I'm not sure if
> it's right - I'll have a shot at it, but any tips are appreciated.

A builder would probably work the best.
- henrik
Re: How to get AST from plugin project [message #761181 is a reply to message #760811] Mon, 05 December 2011 22:26 Go to previous message
Eclipse UserFriend
Quote:
You could have a look at: [link](fork)
Also, "Visualizing the AST" in [link] explains how to do this manually in Eclipse.


Thanks Meinte, that stats view project was really helpful - just what I needed. Very Happy
Previous Topic:advanced qualified names
Next Topic:String to Integer Conversion in Xtend2
Goto Forum:
  


Current Time: Thu Jul 17 04:56:13 EDT 2025

Powered by FUDForum. Page generated in 0.09774 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top