Re: [abc-users] Obtaining a program AST using abc

From: Luca Cavallaro <cavallaro_at_elet.polimi.it>
Date: Tue, 07 Oct 2008 18:34:42 +0200

Dear Eric,
sorry to bother you again with my rookie questions :-P
I found very useful your suggestion to look at abc.aspectj.ExtensionInfo
for an entry level tutorial. What I couldn't find is how to get a
reference to the first node of an AspectJ program AST.
I'll try to be as precise as possible. What I am trying to get access to
is the "AspectJ AST" reported in figure 3 at page 9 of the report
"**Building the abc AspectJ compiler with Polyglot and Soot**":
http://abc.comlab.ox.ac.uk/documents/abc-2004-4.pdf
Is it any way to get there?
Thank you very much again.
Luca

Eric Bodden wrote:
> For polyglot-based ASTs the principal way of accessing these ASTs is
> to use a visitor (any subtype of polyglot.visit.NodeVisitor). Examples
> of those, and how those visitor passes are scheduled can be seen in
> the different ExtensionInfo classes, e.g. abc.aspectj.ExtensionInfo
> (for plain AspectJ) or abc.eaj.ExtensionInfo (for the EAJ language
> extension).
>
> If by "store" you mean "store on disk" that may be tricky because you
> would need to somehow serialize the entire AST. If you just mean
> "store as a reference" that should be easily possible I suppose.
>
> Eric
>
> 2008/10/3 Luca Cavallaro <cavallaro_at_elet.polimi.it>:
>
>> Dear Eric,
>> thank you for your reply. My question was quite generic, so I am trying to
>> sharpen it.
>> I am using polyglot and what I want to do is to compare the ASTs of two
>> different versions of the same program. My idea is to store somewhere the
>> first version AST and to compare the second one with the stored one.
>> May I ask you some further hints on my problem?
>> Thanks
>> Luca
>>
>> Eric Bodden wrote:
>>
>>> Hi Luca.
>>>
>>> The way in which to access and transform the AST depends on whether or
>>> not you are using the JastAdd-based frontend for your abc extension.
>>> So are you using polyglot or JastAdd?
>>>
>>> In cases where you are using polyglot, the extension abc.eaj is a good
>>> entry-level tutorial (although it does not show anything in terms of
>>> AST transformations IIRC), in cases where you are using JastAdd you
>>> should rather have a look at abc.ja.eaj.
>>>
>>> Hope that helps.
>>>
>>> Eric
>>>
>>> 2008/10/3 Luca Cavallaro <cavallaro_at_elet.polimi.it>:
>>>
>>>
>>>> Dear all,
>>>> I am quite new to abc and I was trying to programmatically access and
>>>> manipulate an aAspectJ program Abstract Syntax Tree using abc.
>>>> Anybody can suggest me a solution please?
>>>> Best regards
>>>> Luca Cavallaro
>>>>
>>>> --
>>>> Luca Cavallaro
>>>> Ph.D. student
>>>> DEI, Politecnico di Milano,
>>>> Via Golgi 40
>>>> 200133 Milan,
>>>> Italy
>>>> /------------------------------------------------------------/
>>>> Aphasia is the loss of speech in computer scientists when asked:
>>>> "But of what use is your research?"
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>> --
>> Luca Cavallaro
>> Ph.D. student
>> DEI, Politecnico di Milano,
>> Via Golgi 40
>> 200133 Milan,
>> Italy
>> /------------------------------------------------------------/
>> Aphasia is the loss of speech in computer scientists when asked:
>> "But of what use is your research?"
>>
>>
>>
>>
>>
>
>
>
>

-- 
Luca Cavallaro
Ph.D. student
DEI, Politecnico di Milano,
Via Golgi 40
200133 Milan,
Italy
/------------------------------------------------------------/
Aphasia is the loss of speech in computer scientists when asked:
   "But of what use is your research?"
Received on Tue Oct 07 2008 - 17:34:47 BST

This archive was generated by hypermail 2.2.0 : Tue Oct 07 2008 - 18:00:11 BST