Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>What didn't you understand about <a href="http://www.semanticdesigns.com/Products/DMS/DMSToolkit.html" rel="nofollow noreferrer">DMS</a>? </p> <p>It exists.</p> <p>It has compiler accurate <a href="http://www.semanticdesigns.com/Products/FrontEnds" rel="nofollow noreferrer">parsers/frontends for C, C++, Java, C#, COBOL (and many other languages)</a>.</p> <p>It automatically builds full Abstract Syntax Trees for whatever it parses. Each AST node is stamped with file/line/column for the token that represents that start of that node, and the final column can be computed by a DMS API call.</p> <p>It has a built-in option to generate XML from the ASTs, complete with node type, source position (as above), and any associated literal value. The command line call is:</p> <pre><code> run DMSDomainParser ++XML &lt;path_to_your_file&gt; </code></pre> <p>You can <a href="https://stackoverflow.com/questions/6376662/how-a-ast-for-an-object-oriented-programming-language-would-look-like/6378997#6378997"> see what such an XML result looks like for Java</a>.</p> <p>You probably don't really want what you are wishing for. A 1000 C program may have 100K lines of #include file stuff. A line produces between 5-10 nodes. The DMS XML output is succint and each node only takes a line, so you are looking at ~~ 1 million lines of XML, of 60 characters each --> 60 million characters. That's a big file, and you probably don't want to process it with an XML-based tool.</p> <p>DMS itself provides a vast amount of infrastructure for manipulating the ASTs it builds: traversing, pattern matching (against patterns coded essentially in source form), source-to-source transforms, control flow, data flow, points-to analysis, global call graphs. You'll find it amazingly hard to replicate all this machinery, and you're likely to need it to do anything interesting. </p> <p>Moral: much better to use something like DMS to manipulate the AST directly, than to fight with XML.</p> <p>Full disclosure: I'm the architect behind DMS.</p>
 

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