parsing and FAMIX

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

parsing and FAMIX

Ross Boylan
I've got a bit of my parser going, and am now wondering what I should
parse the elements into.  My initial thought was to extend FAMIX and
then create appropriate elements of it.  I'm not sure that's
appropriate, and would appreciate some advice.

First, it looks as if the sample smalltalk parser uses the AST from RB,
and not the FAMIX models directly.

Second, there are clear differences between the FAMIX models and the
immediate parse results.  For example, suppose I have a variable (or
dataset for SAS) named X.  The parser may treat each as distinct, while
my model needs to describe the single entity to which each occurrence of
the name refers.  That single entity will have much richer information
(relations to other variables, the block of source code in which the
variable is defined or referenced ....) than the parser would initially
care about.

On the other hand, I could use the FAMIX models in initially a
lightweight way; otherwise it seems I could end up with fairly
duplicative parser classes and model classes.

So, would it be best to parse directly into my model classes, or to
parse into some other AST that is later used to make the model?

Thanks.
Ross Boylan

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: parsing and FAMIX

Tudor Girba
Hi,

> I've got a bit of my parser going

Great :)

> and am now wondering what I should
> parse the elements into.  My initial thought was to extend FAMIX and
> then create appropriate elements of it.  I'm not sure that's
> appropriate, and would appreciate some advice.
>
> First, it looks as if the sample smalltalk parser uses the AST from  
> RB,
> and not the FAMIX models directly.

The Smalltalk importer traverses the AST provided by RB to produce a  
FAMIX model.

> Second, there are clear differences between the FAMIX models and the
> immediate parse results.  For example, suppose I have a variable (or
> dataset for SAS) named X.  The parser may treat each as distinct,  
> while
> my model needs to describe the single entity to which each  
> occurrence of
> the name refers.  That single entity will have much richer information
> (relations to other variables, the block of source code in which the
> variable is defined or referenced ....) than the parser would  
> initially
> care about.

Exactly. You want the analysis model to be richer than the AST.

> On the other hand, I could use the FAMIX models in initially a
> lightweight way; otherwise it seems I could end up with fairly
> duplicative parser classes and model classes.
>
> So, would it be best to parse directly into my model classes, or to
> parse into some other AST that is later used to make the model?

If you want a strong model, than doing it in two passes is what you  
want:
- first build the AST
- then resolve the relationships and build a richer model

Cheers,
Doru

> Thanks.
> Ross Boylan
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
www.tudorgirba.com

"Beauty is where we see it."



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev