Re: JS2Moose

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

Re: JS2Moose

abergel
Hi!

I will try to answer you more in detail ASAP. But you are missing the notion of prototype and attributes. A prototype may contains attributes and functions. If things are missing in Famix, the. We can easily extend it. It is made to be expandable.

I reply to the moose mailing list since many expert in modeling will we this email.

Alexandre

> Le 26-09-2014 à 19:18, Leonardo Silva <[hidden email]> a écrit :
>
> Hi Alexandre,
>
> I've checked the JS2Moose project.
>
> Suppose the following JS code:
>
> function circle (radius) {
>  this.radius = radius;
> }
> circle.prototype.getArea = function () {
>  return (this.radius * this.radius * 3.14);
> }
>
>
> For this code, JS2Moose generated the following MSE:
>
> (
> (FAMIX.Function (id: 4)
> (name 'window')
> (staticUseStrictEnabled true)
> (numberOfLinesOfCode 1)
> (numberOfStatements 1))
>
> (FAMIX.Function (id: 5)
> (name 'circle')
> (parentScope (ref: 4))
> (staticUseStrictEnabled true)
> (numberOfLinesOfCode 52)
> (numberOfStatements 1))
>
> (FAMIX.Function (id: 6)
> (name '$5_27')
> (parentScope (ref: 4))
> (staticUseStrictEnabled true)
> (numberOfLinesOfCode 60)
> (numberOfStatements 1))
> )
>
> So, I am not sure this MSE has all the data we need. For example:
>
> - "radius" is not described in the MSE
> - "getArea" in the MSE is represented using another name, "$5_27"
> - there is not association between getArea (id: 6) and circle (id: 5)
>
> Of course, maybe we are doing something wrong, but it seems the MSE
> does not include many important nodes that are available in a JSON file
> generated by Esprima.
>
> We can also have a skype meeting to better clarify this question.
>
> Leonardo

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

Re: JS2Moose

abergel
Hi Leonardo,

Indeed, the MSE file you provide miss crucial information. You probably want to add some FAMIX.Attribute for each variable.
As a first step I would only consider the “this.radius”, since it adds an attribute to the prototype.
I advice you to do it in a step-wise fashion. Add in the MSE what you actually need. Extracting information from the code can be a bit tedious time to time.

Cheers,
Alexandre


On Sep 26, 2014, at 3:46 PM, Alexandre Bergel <[hidden email]> wrote:

> Hi!
>
> I will try to answer you more in detail ASAP. But you are missing the notion of prototype and attributes. A prototype may contains attributes and functions. If things are missing in Famix, the. We can easily extend it. It is made to be expandable.
>
> I reply to the moose mailing list since many expert in modeling will we this email.
>
> Alexandre
>
>> Le 26-09-2014 à 19:18, Leonardo Silva <[hidden email]> a écrit :
>>
>> Hi Alexandre,
>>
>> I've checked the JS2Moose project.
>>
>> Suppose the following JS code:
>>
>> function circle (radius) {
>> this.radius = radius;
>> }
>> circle.prototype.getArea = function () {
>> return (this.radius * this.radius * 3.14);
>> }
>>
>>
>> For this code, JS2Moose generated the following MSE:
>>
>> (
>> (FAMIX.Function (id: 4)
>> (name 'window')
>> (staticUseStrictEnabled true)
>> (numberOfLinesOfCode 1)
>> (numberOfStatements 1))
>>
>> (FAMIX.Function (id: 5)
>> (name 'circle')
>> (parentScope (ref: 4))
>> (staticUseStrictEnabled true)
>> (numberOfLinesOfCode 52)
>> (numberOfStatements 1))
>>
>> (FAMIX.Function (id: 6)
>> (name '$5_27')
>> (parentScope (ref: 4))
>> (staticUseStrictEnabled true)
>> (numberOfLinesOfCode 60)
>> (numberOfStatements 1))
>> )
>>
>> So, I am not sure this MSE has all the data we need. For example:
>>
>> - "radius" is not described in the MSE
>> - "getArea" in the MSE is represented using another name, "$5_27"
>> - there is not association between getArea (id: 6) and circle (id: 5)
>>
>> Of course, maybe we are doing something wrong, but it seems the MSE
>> does not include many important nodes that are available in a JSON file
>> generated by Esprima.
>>
>> We can also have a skype meeting to better clarify this question.
>>
>> Leonardo
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




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

Re: JS2Moose

Tudor Girba-2
Hi,

We should probably add FAMIXPrototype with dedicated semantics that are separate from FAMIXType.

Please keep this discussion on the mailing list.

Cheers,
Doru



On Sun, Sep 28, 2014 at 9:27 PM, Alexandre Bergel <[hidden email]> wrote:
Hi Leonardo,

Indeed, the MSE file you provide miss crucial information. You probably want to add some FAMIX.Attribute for each variable.
As a first step I would only consider the “this.radius”, since it adds an attribute to the prototype.
I advice you to do it in a step-wise fashion. Add in the MSE what you actually need. Extracting information from the code can be a bit tedious time to time.

Cheers,
Alexandre


On Sep 26, 2014, at 3:46 PM, Alexandre Bergel <[hidden email]> wrote:

> Hi!
>
> I will try to answer you more in detail ASAP. But you are missing the notion of prototype and attributes. A prototype may contains attributes and functions. If things are missing in Famix, the. We can easily extend it. It is made to be expandable.
>
> I reply to the moose mailing list since many expert in modeling will we this email.
>
> Alexandre
>
>> Le 26-09-2014 à 19:18, Leonardo Silva <[hidden email]> a écrit :
>>
>> Hi Alexandre,
>>
>> I've checked the JS2Moose project.
>>
>> Suppose the following JS code:
>>
>> function circle (radius) {
>> this.radius = radius;
>> }
>> circle.prototype.getArea = function () {
>> return (this.radius * this.radius * 3.14);
>> }
>>
>>
>> For this code, JS2Moose generated the following MSE:
>>
>> (
>> (FAMIX.Function (id: 4)
>> (name 'window')
>> (staticUseStrictEnabled true)
>> (numberOfLinesOfCode 1)
>> (numberOfStatements 1))
>>
>> (FAMIX.Function (id: 5)
>> (name 'circle')
>> (parentScope (ref: 4))
>> (staticUseStrictEnabled true)
>> (numberOfLinesOfCode 52)
>> (numberOfStatements 1))
>>
>> (FAMIX.Function (id: 6)
>> (name '$5_27')
>> (parentScope (ref: 4))
>> (staticUseStrictEnabled true)
>> (numberOfLinesOfCode 60)
>> (numberOfStatements 1))
>> )
>>
>> So, I am not sure this MSE has all the data we need. For example:
>>
>> - "radius" is not described in the MSE
>> - "getArea" in the MSE is represented using another name, "$5_27"
>> - there is not association between getArea (id: 6) and circle (id: 5)
>>
>> Of course, maybe we are doing something wrong, but it seems the MSE
>> does not include many important nodes that are available in a JSON file
>> generated by Esprima.
>>
>> We can also have a skype meeting to better clarify this question.
>>
>> Leonardo
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




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



--

"Every thing has its own flow"

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

Re: JS2Moose

abergel
Indeed! 

Alexandre

Le 28-09-2014 à 12:40, Tudor Girba <[hidden email]> a écrit :

Hi,

We should probably add FAMIXPrototype with dedicated semantics that are separate from FAMIXType.

Please keep this discussion on the mailing list.

Cheers,
Doru



On Sun, Sep 28, 2014 at 9:27 PM, Alexandre Bergel <[hidden email]> wrote:
Hi Leonardo,

Indeed, the MSE file you provide miss crucial information. You probably want to add some FAMIX.Attribute for each variable.
As a first step I would only consider the “this.radius”, since it adds an attribute to the prototype.
I advice you to do it in a step-wise fashion. Add in the MSE what you actually need. Extracting information from the code can be a bit tedious time to time.

Cheers,
Alexandre


On Sep 26, 2014, at 3:46 PM, Alexandre Bergel <[hidden email]> wrote:

> Hi!
>
> I will try to answer you more in detail ASAP. But you are missing the notion of prototype and attributes. A prototype may contains attributes and functions. If things are missing in Famix, the. We can easily extend it. It is made to be expandable.
>
> I reply to the moose mailing list since many expert in modeling will we this email.
>
> Alexandre
>
>> Le 26-09-2014 à 19:18, Leonardo Silva <[hidden email]> a écrit :
>>
>> Hi Alexandre,
>>
>> I've checked the JS2Moose project.
>>
>> Suppose the following JS code:
>>
>> function circle (radius) {
>> this.radius = radius;
>> }
>> circle.prototype.getArea = function () {
>> return (this.radius * this.radius * 3.14);
>> }
>>
>>
>> For this code, JS2Moose generated the following MSE:
>>
>> (
>> (FAMIX.Function (id: 4)
>> (name 'window')
>> (staticUseStrictEnabled true)
>> (numberOfLinesOfCode 1)
>> (numberOfStatements 1))
>>
>> (FAMIX.Function (id: 5)
>> (name 'circle')
>> (parentScope (ref: 4))
>> (staticUseStrictEnabled true)
>> (numberOfLinesOfCode 52)
>> (numberOfStatements 1))
>>
>> (FAMIX.Function (id: 6)
>> (name '$5_27')
>> (parentScope (ref: 4))
>> (staticUseStrictEnabled true)
>> (numberOfLinesOfCode 60)
>> (numberOfStatements 1))
>> )
>>
>> So, I am not sure this MSE has all the data we need. For example:
>>
>> - "radius" is not described in the MSE
>> - "getArea" in the MSE is represented using another name, "$5_27"
>> - there is not association between getArea (id: 6) and circle (id: 5)
>>
>> Of course, maybe we are doing something wrong, but it seems the MSE
>> does not include many important nodes that are available in a JSON file
>> generated by Esprima.
>>
>> We can also have a skype meeting to better clarify this question.
>>
>> Leonardo
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




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



--

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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