Do tools exist which automatically find copy-and-paste code? [closed] - code-analysis

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Are there tools out there which could automatically find copy-and-paste code among a set of files?
I was thinking of writing a script for this, which would just search for equal strings, but such script would find mostly irrelevant equalities. (Such as private final static ...).

Yes, try the Copy Paste Detector.

Our CloneDR is a tool for finding exact and near-miss blocks of code constructed by copy and paste activities.
It can handle systems of millions of lines of code.
It uses precise language grammars to pick out language structures (identifiers, expressions, statements, blocks, functions, classes, packages, ...) that have been copied, and to determine the points of variation across the sets of clones (any of those structures can be parameters!)
CloneDR operates on a wide variety of languages: C, C++, C#, Java, PHP, COBOL, Python, Ada, Fortran, EGL and visual basic (VBScript, VB6, VB.net).
The website has a number of sample clone detection reports from a variety of those languages.
This product is available for evaluation on http://www.semanticdesigns.com. Other open source alternatives are Simian and PMD CPD

http://patterninsight.com/products/cp-miner.php
Related paper - http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.123.113

CloneDigger for Python and Java.

Related

Source code analyzing tool for COBOL on VMS/VAX Platform [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Can someone please recommend a tool for analyzing, improving, finding "dead code", provide statistics etc. for a source code on COBOL language on VMS/VAX OS and RDB Database?
Thanks.
Some compilers have options for locating dead code, so you may already have the tools you desire. Please keep in mind that there are going to be situations where the code is dead and you cannot tell via static source code analysis.
if a = 1
move 'error' to out-message
end-if
If a can never be 1 then this is dead code. Static source code analysis may not find more complicated instances of this scenario, particularly if the value of a comes from outside the program being analyzed - perhaps a database.
A cursory scan of the static source code analysis tools listed on Wikipedia shows the commercial products are pricy (thousands of euros). The open source tools don't appear to provide much COBOL coverage. You might want to check those out for yourself as I admit I didn't do a thorough evaluation but instead just scanned their documentation.
COBOL is a difficult language to parse.
I have never used it, but the DecSet suite of products includes a product called PCA - Performance and Coverage Analyser. This may be what you are looking for.

Automatic documentation of Fortran functions, modules and subroutines [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Is there anything like Javadoc for documenting Fortran code? How does one document the API for the many functions they have so that they can find what they want more easily?
Not "standard", but I've used a program called "robodoc" that is able to work with Fortran.
Nowadays I believe Doxygen supports Fortran as well, which IMHO is a better tool than robodoc.
As janneb mentioned "robodoc" is clean, easy and hence useful. But you it will not analyze your program and you have to do everything yourself. On the other hand, Doxygen have incorporated the modern Fortran features(derived data types, type bound procedures, ... ) and just like C++ you can get an analysis of your program along with graphs etc.

Lisp on embedded platforms [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Are there any open source Lisp compilers suitable for real-time embedded applications? I.e. with incremental garbage collection, customisable memory handling, small footprint, etc.
Edit:
To clarify, by "compiler" I meant native code, not bytecode interpreter (though the suggested interpreting implementations for microcontrollers are interesting for being a lot smaller than what I thought possible!).
Take a look at Picobit and the code, which is a Scheme for microcontrollers. There is also tinyscheme, but I don't know how suitable it is for embedding into smaller processors.
There are some implementations that compile to C code, e.g. ECL (Embeddable Common Lisp). There is also a very recent library that compiles a subset of Common Lisp to a subset of C++ for the Arduino.
You mentioned "real-time" so nonchalantly, but getting real-time with garbage collection is not trivial. There do exist real-time garbage collectors, but I am not aware of any Lisp implementations using them yet.
There is also Hedgehog Lisp from Oliotalo, licensed under LGPLv2.1, with standard library licensed under BSD.

Need help designing an interpreter [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
i'm thinking on doing an undergrad project on building an interpreter for a simple/rudimentary custom language (perl / C like). I would be be glad if someone could point me in the right direction to start. Most of the books/resources i find are on theoretical implementation of compilers. Are there any resources aimed at interpreters ? i'm thinking of implementing it in C++, but have very little knowledge on the subject of interpreter design, so any pointers to books/references will be appreciated
The parsing of the source code is not very much different between a compiler and an interpreter. And that is what most textbooks on compilers are about.
There are some nice tools now to implement custom languages.
You might want to checkout Xtext in the Eclipse Modelling Package (http://www.eclipse.org) or MPS (http://www.jetbrains.com/mps/), the language workbench of IntelliJ which is freely available.
Both allow you to create languages and provide the tools to generate code from the source and the tooling to help creating the code.
They also create abstract syntax trees which may be directly manipulated, i.e. executed. Then you have an interpreter.
The classical approach would be to use bison/yacc for as a lexer, respectively parser, and many newer tools are currently available like antlr. The output of the parser is then again the abstract syntax tree ready to do interprete or generate code from.
An Incremental Approach to Compiler Construction - it's about creating compilers, but it might be a good starting point to find references from.
I wrote an interpreter for reading and converting logic expressions at Uni. Wrote it in C, Lexx and Yacc which old school Unix and C programmers seem to swear by. Pretty powerful once you get the hang of them, but reasonably steep learning curve I would say.
http://www.lugbe.ch/action/reports/lex_yacc.pdf

Favorite Documentation Generator system? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm a jack-of-all-trades-master-of-none programmer and as I jump around languages, quality consistent documentation is becoming more and more important to me. I've recently been using Doxygen, but Wikipedia reveals the usual ridiculous list of similar frameworks.
What is your favorite documentation generator and why? (Vote where you agree to keep it tidy!)
I use different files written in MediaWiki MarkUp, since this is easy to learn for everyone. I convert this to HTML and a CHM file, and to LaTeX for the PDF documentation.
This was the most painless way for me to generate Online documentation AND printable documentation in one strike with a simple way of input.
The tools I use are org.eclipse.mylyn.wikitext with a custom DocumentBuilder for LaTeX, the Microsoft Help compiler (which sadly only runs on windows), and a LaTeX distribution.
EDIT: I managed to get the Microsoft Help compiler running with Wine, so my Linux build server is now able to create the whole documentation automatically.