aa bb via llvm-dev
2016-Mar-15 02:43 UTC
[llvm-dev] [cfe-dev] GSoC AST->XML project still open?
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div> <div>Hi,</div> <div> </div> <div>I have a few questions about the AST->XML project as listed on the Open projects page:</div> <div> </div> <div>0. Is my understanding correct that the purpose of the project is to produce 2 things: a Schema (an XML schema? as in a XSD file?) and a XML formatter (does this need to be written in a particular language? does it need to be compiled?). The XML formatter will be either a part of Clang, or a Clang plugin, or makes use of the Clang C API LibClang, or otherwise, that takes as input Clang's internal AST of a piece of source code (in C/C++/Obj C) and outputs a XML representation of the Clang-produced AST that a. Does not change (what doesn't change? the exact output or the schema that the output conforms to or something else?) when Clang changes (this is how I interpreted "stable across Clang versions"). b. Is able to represent the different languages (C/C++/Obj C) "abstractly and not tied to the internal ASTs that Clang uses" (how? do we simply translate the AST to XML, ensuring that it conforms to the Schema, or do we need to further transform the AST to another more "abstract" form before/after converting it to XML?) and c. Produces output that can be verified against the Schema (is verification here the same as validation? like, XML validation using Xerces?).</div> <div> </div> <div>1. Is the project still required? I understand that having a detailed dump of the AST is useful for compilers (e.g code generation from the AST?) and static analysis tools (e.g control flow graph analysis - unreachable code?). Is clang's current -ast-dump option good enough for compilers and static analysis tools, removing the need for the project? Or is there some alternative Clang-AST-dump tool that is currently used that obviates the need for this project? Is it still the case that compilers and static analysis tools which wish to make use of the Clang-produced AST must either be a Clang-plugin or use the LibClang API (the C interface to Clang) which is tied to the Clang binary? I found an incomplete project that attempts to translate the Clang AST to XML (https://github.com/BentleyJOakes/PCX). There are also tools that produce XML representations of ASTs such as DMS Software Reengineering Toolkit which do not use Clang. Why are these not acceptable?</div> <div> </div> <div>2. Regarding the -ast-dump-xml option that appears to have been removed sometime in 2013 ("I removed an XML printer that was underdeveloped and unmaintained. Now that the normal AST dumping has been greatly improved, it's probably time to remove the XMLish dump as well."). Is this project related to that in any way?</div> <div> </div> <div>3. Is my understanding correct that the schema must be general enough to encompass all possible future changes to the C, C++ and Objective C language specifications? Like, if a new construct is added to the C++ language (let's say for example, try-catch-finally), should the schema be able to anticipate all such changes? Let's take a simple hello world program in C++ test.cpp:</div> <div><br/> #include<stdio.h><br/> int main()<br/> {<br/> printf("Hello World");<br/> return 0;<br/> }</div> <div><br/> If I run clang -Xclang -ast-dump -fsyntax-only test.cpp I get (removed some of the output):</div> <div><br/> FunctionDecl main<br/> `-CompoundStmt<br/> |-CallExpr<br/> | |-ImplicitCastExpr<br/> | | `-DeclRefExpr printf<br/> | `-ImplicitCastExpr<br/> | `-StringLiteral "Hello World"<br/> `-ReturnStmt<br/> `-IntegerLiteral 0</div> <div><br/> What should the XML output look like? Here's how I imagine it might look:</div> <div><br/> <FunctionDecl name="main"><br/> <CompoundStmt><br/> <CallExpr><br/> <ImplicitCastExpr><br/> <DeclRefExpr name="printf"/><br/> </ImplicitCastExpr><br/> <ImplicitCastExpr><br/> <StringLiteral value="Hello World"/><br/> </ImplicitCastExpr><br/> </CallExpr><br/> <ReturnStmt><br/> <IntegerLiteral value=0 /><br/> </ReturnStmt><br/> </CompoundStmt><br/> </FunctionDecl></div> <div><br/> What should the schema look like? Here's what I imagine part of the XML schema might look like:</div> <div><br/> <xsd:complexType name="CompoundStmt"><br/> <xsd:sequence><br/> <xsd:element name="CallExpr" minOccurs="0" maxOccurs="unbounded"><br/> ....</div> <div><br/> If my basic understanding is correct, that means we need to know every construct in the language (such as "CallExpr") before we can write the schema, and so if a new construct is introduced (or some other change is made to the language specification) that means we would have to edit the schema? Am I completely misunderstanding what a XML schema is?</div> <div> </div> <div> <div>4. I have only taken an undergrad-level compilers course at university and have not worked with the Clang AST or XML in any significant capacity. Do I have enough expertise to create the schema or the XML formatter?</div> </div> <div> </div> <div>5. Will I need to maintain the project afterwards?</div> <div> </div> <div>6. Is there a mentor for this project?</div> <div> </div> <div>Thanks again and sorry for asking so many questions.</div> <div> <div style="margin: 10.0px 5.0px 5.0px 10.0px;padding: 10.0px 0 10.0px 10.0px;border-left: 2.0px solid rgb(195,217,229);"> <div style="margin: 0 0 10.0px 0;"><b>Sent:</b> Monday, March 14, 2016 at 4:06 PM<br/> <b>From:</b> "Vassil Vassilev" <v.g.vassilev@gmail.com><br/> <b>To:</b> "aa bb" <128516@gmx.com>, cfe-dev@lists.llvm.org<br/> <b>Subject:</b> Re: [cfe-dev] GSoC AST->XML project still open?</div> <div>Hi,<br/> It seems that the project is listed at the clang's open projects<br/> (<a href="http://clang.llvm.org/OpenProjects.html" target="_blank">http://clang.llvm.org/OpenProjects.html</a>). You should follow the<br/> guidelines by Anton:<br/> <a href="http://lists.llvm.org/pipermail/cfe-dev/2016-March/047919.html" target="_blank">http://lists.llvm.org/pipermail/cfe-dev/2016-March/047919.html</a><br/> --Vassil<br/> On 12/03/16 00:30, aa bb via cfe-dev wrote:<br/>> Hi,<br/> ><br/> > Is the XML Representation of ASTs GSoC project still open? I'm very interested in the project, but I have only taken one compilers class at university.<br/> ><br/> > Thanks.<br/> > _______________________________________________<br/> > cfe-dev mailing list<br/> > cfe-dev@lists.llvm.org<br/> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br/></div> </div> </div> </div></div></body></html>
Anton Korobeynikov via llvm-dev
2016-Mar-15 05:42 UTC
[llvm-dev] [cfe-dev] GSoC AST->XML project still open?
> I have a few questions about the AST->XML project as listed on the Open > projects page:Just random thought - probably you should not limit yourself to XML. Some of LLVM's subprojects are pretty happy with YAML. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
David Chisnall via llvm-dev
2016-Mar-15 12:13 UTC
[llvm-dev] [cfe-dev] GSoC AST->XML project still open?
On 15 Mar 2016, at 05:42, Anton Korobeynikov via llvm-dev <llvm-dev at lists.llvm.org> wrote:> >> I have a few questions about the AST->XML project as listed on the Open >> projects page: > Just random thought - probably you should not limit yourself to XML. > Some of LLVM's subprojects are pretty happy with YAML.FreeBSD is slowly moving utilities over to using libx, which allows human-friendly text, XML, and JSON all to be generated from the same source code. If anyone is thinking of adding more machine-consumable output, then it would probably be worth investigating. David