[cfe-dev] Writing C++ refactoring tools in Common Lisp

Christian Schafmeister chris.schaf at verizon.net
Tue Jan 7 08:16:03 PST 2014

Hey folks,

I’ve written a new Common Lisp environment/compiler over the past two years.  
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.  

I want to do some automated refactoring to improve my C++ code so I’m exposing the Clang ASTMatcher and Refactoring libraries.

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.

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.

My goal is to mimic C++ ASTMatchers like:


Using S-expressions: (record-decl (has-descendent (if-stmt (has-true-expression (expr (has-descendant( if-stmt)))))))    

And the source-to-source translation code will be small lambda functions that use the resulting MatchResults.

That way I don’t have to write a lot of documentation :-).

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?



Christian Schafmeister
Associate Professor
Chemistry Department
Temple University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140107/5ff1866c/attachment.html>

More information about the cfe-dev mailing list