[squeak-dev] Smacc and CPD

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

[squeak-dev] Smacc and CPD

Davide Falzoni
Hi Folks!
 I'm trying to build a light version of a copy/paste detector (see http://pmd.sourceforge.net/cpd.html) in Squeak (for malltalk code), but I'm a novice in using Smacc, can you point me in the right direction or show me if there are similar projects developed by the Squeak community?
Thanks
 Davide


Never miss a thing. Make Yahoo your homepage.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Smacc and CPD

Davide Falzoni
No hints?
Davide

Davide Falzoni <[hidden email]> wrote:
Hi Folks!
 I'm trying to build a light version of a copy/paste detector (see http://pmd.sourceforge.net/cpd.html) in Squeak (for malltalk code), but I'm a novice in using Smacc, can you point me in the right direction or show me if there are similar projects developed by the Squeak community?
Thanks
 Davide

Never miss a thing. Make Yahoo your homepage.


Looking for last minute shopping deals? Find them fast with Yahoo! Search.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Smacc and CPD

Lukas Renggli
> No hints?
> Davide

The NewCompiler on squeaksource.com uses SmaCC for example. SmaCC
itself comes with many examples. It also includes a small tutorial.

What I find a bit strange how you ask your question: "I have problem
X. How do I use SmaCC to solve it?" In my opinion you should first try
to formulate the steps to get to a solution and only afterwards look
for tools that could help you reaching this goal? I don't understand
what you want to do ...

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Smacc and CPD

Matthias Berth-2
Davide, Lukas,

I'm just guessing here - Davide wants to compare the parse trees of,
say, two methods, as opposed to the source code. That's what the CPD
(copy/paste detector) is proud of, they can identify copied Java code
even if it was reformatted.

In Smalltalk, you can access or create the parse tree of a method (I
don't know how, sorry). So there is no need to write your own parser.

Another route would be to normalize the code before comparison, check
out the implementors / senders of prettyPrint:. Then you would compare
lines of normalized code.

HTH

Matthias





On Mon, Mar 3, 2008 at 11:05 PM, Lukas Renggli <[hidden email]> wrote:

> > No hints?
>  > Davide
>
>  The NewCompiler on squeaksource.com uses SmaCC for example. SmaCC
>  itself comes with many examples. It also includes a small tutorial.
>
>  What I find a bit strange how you ask your question: "I have problem
>  X. How do I use SmaCC to solve it?" In my opinion you should first try
>  to formulate the steps to get to a solution and only afterwards look
>  for tools that could help you reaching this goal? I don't understand
>  what you want to do ...
>
>  Lukas
>
>  --
>  Lukas Renggli
>  http://www.lukas-renggli.ch
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Smacc and CPD

Davide Falzoni
Hi Matthias

--- Matthias Berth <[hidden email]>
wrote:

> Davide, Lukas,
>
> I'm just guessing here - Davide wants to compare the
> parse trees of,
> say, two methods, as opposed to the source code.
> That's what the CPD
> (copy/paste detector) is proud of, they can identify
> copied Java code
> even if it was reformatted.


Right, that's my purpose


> In Smalltalk, you can access or create the parse
> tree of a method (I
> don't know how, sorry).

So do I :-)

> So there is no need to write
> your own parser.

Ok

> Another route would be to normalize the code before
> comparison, check
> out the implementors / senders of prettyPrint:. Then
> you would compare
> lines of normalized code.


FYI, on the visualworks list, people suggest me to
look at smalldude
(http://moose.unibe.ch/tools/smalldude)

Thanks
 Davide

> HTH
>
> Matthias
>
>
>
>
>
> On Mon, Mar 3, 2008 at 11:05 PM, Lukas Renggli
> <[hidden email]> wrote:
> > > No hints?
> >  > Davide
> >
> >  The NewCompiler on squeaksource.com uses SmaCC
> for example. SmaCC
> >  itself comes with many examples. It also includes
> a small tutorial.
> >
> >  What I find a bit strange how you ask your
> question: "I have problem
> >  X. How do I use SmaCC to solve it?" In my opinion
> you should first try
> >  to formulate the steps to get to a solution and
> only afterwards look
> >  for tools that could help you reaching this goal?
> I don't understand
> >  what you want to do ...
> >
> >  Lukas
> >
> >  --
> >  Lukas Renggli
> >  http://www.lukas-renggli.ch
> >
> >
>
>



      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ