Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you are interested in are "source-to-source" <a href="http://en.wikipedia.org/wiki/Program_transformation" rel="nofollow">program transformation systems</a>.</p> <p>A parser is necessary but hardly sufficient. (In fact, a parser for <em>your dialect</em> of the langauge you are using is necessary... given that people use so many "programming" languages, this is a lot of parsers necessary). You also need to capture the parse result (generally as a tree), be able to manipulate that tree somehow, and then regenerate <em>valid</em> source code from the tree. If you want that source code to be a permanent change to source manually programmed, the parser/tree/unparser combination must preserve code formatting and comments to maximal extent practical.</p> <p>Often you can't really transform code unless the meaning of the identifiers is clear; so in practice you need to not only parse but construct symbol tables (at this point you have what amounts to a compiler front end, not a parser). Many transformations require tracking information flows (control flow, dataflow, points-to, who-calls, ...). Without these features, these tools are not very effective for the procedural/OO languages that constitute by far the bulk of source code. (The functional languages guys can get by with less flow analysis because everything is an expression, but most code written isn't functional, so this doesn't matter in a practical sense).</p> <p>There are a number of source-to-source transformation systems, some language specific (e.g., <a href="http://wiki.netbeans.org/Jackpot" rel="nofollow">JackPot</a> for Java); a few are parameterized by langauge definitions (TXL, Stratego, DMS).</p> <p>Some of the langauge specific one provide symbol tables and flow analysis. I know of only one transformation that provides these capabilities for a number of programming languages, and that's our <a href="http://www.semanticdesigns.com/Products/DMS/DMSToolkit.html" rel="nofollow">DMS Software Reengineering Toolkit</a>. </p> <p>DMS provides this for a number of real programming languages and their common dialects, not toys: C, Java, COBOL. </p> <p>DMS is one of the few source-to-source program transformation system for C++; it has been used in anger to make changes to large C++ programs. <a href="http://clang.llvm.org/" rel="nofollow">Clang</a> is pretty close, I think, certainly in ambition; <a href="http://rosecompiler.org/" rel="nofollow">Rose Compiler</a> is another used mostly in supercomputing circles, but both of these are C++ (perhaps with C thrown in) specific.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload