<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hey folks,</div><div><br></div><div><br></div><div>I’ve written a new Common Lisp environment/compiler over the past two years. </div><div>It uses LLVM as the back-end (by exposing the LLVM C++ library to Common Lisp) and interoperates with C++ in that it has a template library like boost::python for exposing arbitrary C++ classes/functions to Common Lisp. </div><div><br></div><div>I want to do some automated refactoring to improve my C++ code so I’m exposing the Clang ASTMatcher and Refactoring libraries.</div><div><br></div><div>I also think it would be really cool to write refactoring tools in a dynamic language like Lisp - without all the exhausting boilerplate required by the C++ approach.</div><div><br></div><div>So I’m exposing the Clang AST library to this Common Lisp environment with the goal of writing a general tool for writing C++ refactoring tools in Common Lisp.</div><div><br></div><div>My goal is to mimic C++ ASTMatchers like:</div><div><b style="color: rgb(34, 34, 34);"><br></b></div><div><b style="color: rgb(34, 34, 34);">recordDecl(hasDescendant(</b></div><div><b style="color: rgb(34, 34, 34);"> ifStmt(hasTrueExpression(</b></div><div><b style="color: rgb(34, 34, 34);"> expr(hasDescendant(</b></div><div><b style="color: rgb(34, 34, 34);"> ifStmt()))))))</b></div><div><div><br></div></div><div>Using S-expressions: <b>(record-decl (has-descendent (if-stmt (has-true-expression (expr (has-descendant( if-stmt))))))) </b> </div><div><br></div><div>And the source-to-source translation code will be small lambda functions that use the resulting MatchResults.</div><div><br></div><div>That way I don’t have to write a lot of documentation :-).</div><div><br></div><div>Currently I’m looking at calling the ASTMatcher/Dynamic/VariantValue interface to build ASTMatchers from S-expressions - does that sound like a good idea - or is there a better approach I should be exploring?</div><div><br></div><div><br></div><div>Best,</div><div><br></div><div>.Chris.</div><div><br></div><div>Christian Schafmeister</div><div>Associate Professor</div><div>Chemistry Department</div><div>Temple University</div></body></html>